1

I need to calculate zonal statistics (both mean and standard deviation) for each polygon within a shapefile. This I need to calculate from around one hundred rasters, stored in .tiff format. Each raster includes an index per specific date.

The zonal statistics I need to collect in the table, which structure must be as follows:

Polygon ID Suffix date mean stdev date mean stdev
418111111 NDVI 03/01/2019 0.36555 15.26314 06/01/2019 0.26555 25.33333
523333333 NDVI 03/01/2019 0.52325 16.36514 06/01/2019 0.76255 26.33333
Phil
  • 7,287
  • 3
  • 36
  • 66
  • 1
    What have you tried to solve the problem? If you can show us a [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) of what you've tried and where you've come into a problem, you'll be much more likely to get an answer. – caldwellst Feb 10 '22 at 15:55
  • I would suggest to 1/ match and crop/mask rasters with corresponding polygons (`terra` package), 2/ calculate the desired values: mean, stdev and 3/ collect in data frame (table). – Grzegorz Sapijaszko Feb 11 '22 at 20:56

1 Answers1

0

This is late, but if you're working in python, you may find xagg useful; it allows you to aggregate raster data onto polygons. It currently only supports mean calculations, however.

ks905383
  • 160
  • 7