I have a shapefile with polygons. And I have a global raster file. I want to overlay the shapefile's polygons onto the raster grid and calculate the mean raster value for each polygon.
How can I do this using GDAL, writing the results to the shapefile?
Best Answer
In R you can do
e is a vector with the mean of the raster cell values for each polygon.