isciences / exactextract

Fast and accurate raster zonal statistics
Apache License 2.0
259 stars 33 forks source link

bilinear polygon extraction? #18

Open kendonB opened 4 years ago

kendonB commented 4 years ago

The raster and terra R packages provide points extraction via "bilinear" interpolation. This is an appropriate method to extract from rasters that represent point processes such as weather. See the formula here: https://stackoverflow.com/questions/50086717/bilinear-interpolation-artifacts

Is there any clever way to compute the polygon analog of this?

mdsumner commented 1 year ago

could you expand on what this is? I can't understand it, the point or line case is obvious per vertex but I don't get this, got an example?

kendonB commented 1 year ago

I haven't been able to find a worked example, but imagine you create an even grid of n points within the polygon, perform bilinear extraction on those n points, then average. Let n go to infinity and that's the quantity.

mdsumner commented 1 year ago

ah, ok thanks! that would be like resizing the raster with alg bilinear first, but efficient by only doing it within the polygon/s

that's an interesting case, like using a layer as a mask for lazier downstream workflows, it has other uses but not sure where it belongs