GeoTIFF / geoblaze

Blazing Fast JavaScript Raster Processing Engine
http://geoblaze.io
MIT License
181 stars 28 forks source link

area #230

Open DanielJDufour opened 6 months ago

DanielJDufour commented 6 months ago

Is your feature request related to a problem? Please describe. Really should support area results better, being the reality that a lot of people multiply the count of pixels in a specific class with pixel size to get the area of X. For example, something like area of flooding in an area, by number of pixels.

Describe the solution you'd like I'm not sure yet, but maybe options like

geoblaze.validArea(url, geom) // area of valid pixels

geoblaze.invalidArea(url, geom) // area of no data and invalid pixels

// like histogram, but instead of key => count, it's key => area (i.e. count * pixelarea)
geoblaze.histogramArea(url, geom)

Describe alternatives you've considered People could handwrite these calculations. We could also return metadata to the user to calculate the area themselves. Part of my concern is that if people use virtual resampling, that'll shrink the pixels sizes, so they'd have to use the dynamic pixel size of the virtual resampling calculation and not a fixed size.

I wonder if we could add frequency and area as params to the pre-existing histogram function

histogram(georaster, geometry, { value_type: "area" })

histogram(georaster, geometry, { value_type: "frequency" })

Additional context N/A