# Questions tagged [zonal-statistics]

Zonal statistics summarize the values of one raster within the zones of another dataset (either raster or vector) and output the results as a raster (for a single statistic) or table (for multiple statistics).

477 questions
Filter by
Sorted by
Tagged with
1 vote
18 views

### Getting Sentinel-2 raster values for points on Google Earth Engine

I am calculating TSM and chlorophylle in a river, for each parameter I used a function to create a new band that gives me information about each one. First I want to calculate the mean value for ...
28 views

### Weighted zonal statistics in Python

I'm asking something similar than Weighted zonal statistics in Python and/or R. I know very well the R-side of this question, but I can't figure out the answer for Python. So far I can compute non-...
186 views

### Zonal statistics with GDAL only (not Python)

I'm helping an undergrad with her dissertation. She has monthly mean data from ERA-5 for three variables in netcdf format for the past 20 years. She wants a CSV or Excel file which contains the zonal ...
162 views

### Polygon Drill on Open Data Cube

I face a crucial problem with ODC. I try to do a spatial join with a shapefile (polygon drill). I have followed the following steps: Read the shapefile and get the first polygon to test Ensure that ...
131 views

### Calculating zonal entropy index for raster using rasterstats

I have an elevation raster and a grid shapefile: What I want to do is calculate zonal statistics of the raster based on the grid features. The "statistic" I want is the entropy index (...
1 vote
22 views

### Resampling high resolution data into lower resolution based on most common value

I want to use a high-resolution classification (3cm) as training data for a classification using Sentinel 2 data (10m). To do so, I want find which high-res value is most common within each Sentinel &...
1 vote
25 views

### Zonal Statistics and output cell size

I am trying to use Zonal Statistics to find the most common value of a high-resolution classification within a coarser fishnet grid (10x10 m). The idea is to use this high-res classification as ...
41 views

### PostGIS SummaryStats with many polygons and many bands

I have a hyperspectral image (160 bands) and a polygon shapefile with several thousand polygons. I need to extract mean value of each band within each polygon and store it in a table. I decided to try ...
36 views

### Unexpected values for 'SUM' and 'COUNT' in Zonal Statistics

I am using the zonal_stats function in the rasterstats package to evaluate the pixels within each polygon in a shapefile. The raster used is a binary mask layer (object exg) in which pixels ...
427 views

### Zonal Statistics on discrete values in raster using ArcGIS for Desktop?

I am using ArcGIS 10.3 for Desktop. I am using Corine Land Cover raster data for Southern European Countries, this data gives discrete values to particular land uses (e.g. 1 = agricultural land, 2= ...
1 vote
494 views

### Overlaying Line (Vector) Layer on Raster Zones?

I am using ArcGIS 10 I have a raster layer with 3 values that make up zones. For the purpose of this example, lets say these zones are forest, grass, and open water. My whole raster is made up of ...
1 vote
29 views

### QGIS Zonal Statistics

I have used and FAO raster file for e.g., suitability for agriculture and I calculate zonal statistics at the NUTS 2 level. However, given the fact that the cell size of each cell is not the same ...
40 views

### Zonal Statistics not Working Properly in ArcGIS Desktop

I have two rasters, one that describes different zones of the world and a second one which is the input raster that has continuous values for a variable. I am using the Zonal Statistics tool to ...
1 vote
24 views

### How to calculate sum of night light radiance for each feature in a feature collection?

I have a shapefile which contains 36 polygons (districts/counties). For each district, I want to calculate sum of lights (as well as count total number of pixels). I tried following code but failed. ...
1 vote
49 views

### QGIS - calculate volume from DSM

I've been following a tutorial (https://www.pointsnorthgis.ca/blog/how-to-calculate-surfacecut-volume-qgis-advanced/) in order to try to find volumes for various stockpiles that I took imagery of with ...
129 views

### How to use zonal statistics in R with shapefile

I have a county shapefile and a DEM raster, I want to extract mean DEM of every counties. There is a function 'zonal' in raster package, however, it requires raster not shapefile. How can I do this ...
194 views

### zonal_stats returns PROJ error

I have been using zonal_stats from the rasterstats module for quite some time in Python. And I have never come across this error, which I tried to Google to find some solution with no success. ...
587 views

### "Zonal statistics" for two polygon layers using ArcMap

I have 2 polygon layers: one is a vector grid with attribute values for each "polygon cell" the other including administrative boundaries I would like to calculate the mean value of all ...
1 vote
68 views

### Zonal statistic that fits area portion of polygons using ArcMap

As you can see below, I have a polygon feature with boundary of seven regions. I need to extract the raster value intersect to it that fit portion of every region area touches to the pixel. For ...
49 views

### Cumulative sum of thermal anomalies in Earth Engine

I am writing a short script that will be used to chart thermal anomalies (FIRMS) by year for a given boundary. The following code will achieve this... var now = new Date() // IMPORT MODIS ACTIVE ...
124 views

### Error with function argument when using extract function in R

I am using the script described here to try to extract a count of raster cells within polygons in a shapefile. This code worked for me yesterday but today I am getting the following error: Error in ...
21 views

### Count area of specific raster value inside polygons

I am currently working with annual forest loss raster data from Global forest watch. (https://data.globalforestwatch.org/documents/14228e6347c44f5691572169e9e107ad/explore) Data is built up so that ...
135 views

### QGIS Zonal statistics and Python Rasterstats yield different results

I have one polygon shapefile and one raster file (both EPSG: 4326) and I am calculating the minimum, maximum and average raster value in all polygons using two methods: QGIS 3.16.10, Zonal statistics ...
1 vote
667 views

### Zonal statistics results in some NULL values in QGIS?

I used zonal statistics through QGIS to assign raster image values to polygons. Here, Raster image has value in range from 0 to 238.567. As a result, some NULL values are assigned to polygons, even ...
28 views

### Zonal Statistics - the algorithm computes the average statistics for all the polygons of the layer vector

Using QGIS, I want to compute the average elevation per 1890 US counties. I have a shapefile with the 1890 counties boundaries with fixed geometry, and STRM elevation data, saved as a GeoTIFF file. ...
1 vote
76 views

### Calculating area of pixles for certain Aspect value per specific area?

I am using ArcGIS 10.6. I have the aspect (raster file) for the roof of buildings at the city scale. Now I want to calculate the area of each aspect group per building. I tied zonal statistics, zonal ...
1 vote
130 views

### Mapping over a reduceRegions command in Earth Engine

I have a feature collection of about 80,000 tiles, and I am trying to calculate the annual maximum drought severity index score for each tile using TerraClimate data. TerraClimate is an image ...
23 views

### Rasterize monthly mesh data

I am working with QGIS and I would like to rasterize mesh data (ERA5 monthly averaged data on temperature) from 1998 to 2018 in order to perform zonal statistics. However, given the huge number of ...
1 vote
56 views

### Find mean zonal stats using a geoseries or GeoJSON object - Python

I have a TIFF file with imperviousness levels and a Geoseries object containing the boundary coordinates of circles around 9 points. I want to find the mean value using zonal_stats but I don't know ...
23 views

### Summarizing global soil erosion raster data

Using ESDAC's Global Soil Erosion data which is 25km resolution with values representing metric tons lost per hectare per year. I'm trying to summarize by certain regions using ArcGIS Pro Zonal ...
1 vote
141 views

### Calculating zonal statistics as table for all attributes (columns) in raster using ArcGIS Desktop

I have a raster that has multiple columns in the attribute table that I can symbolize. I would like to calculate zonal statistics as a table for each of the columns in the raster attribute table ...
241 views

### How GEE align pixels and projection when reduce resolution?

Here is the thing: I want to count how many Landsat pixels 30x30m were included in a 500x500m MODIS pixel. It is basically a zonal statistics, and I use reduceResolution to compute. But the issue is: ...
1 vote
86 views

### QGIS Zonal Statistics returns empty

I am using QGIS 3.18 to do a quick calculation of the population inside a buffered area. The data for the population comes from WorldPop, the file I got is in the form of GeoTIFF. I inserted it as a ...
188 views

### Unable to perform zonal stats in python because of Attribute Error

I am trying to carry out a simple zonal statistics task in python, and am having trouble getting this to work. I have a raster layer (in black/grayscale) and a roads polygons layer (in green, actually ...
242 views

### Calculating percentage of area by district of land use type

I have a file geodatabase feature class, type polygon, of land use type. SEQ LU Update X project clip in the attached. I have a districts shapefile (shapefile feature class polygon). All_Brisbane in ...
72 views

### Unable to perform zonal statistics in Python because of affine error

I have a raster layer and a polygons layer I want to use for zonal statistics, however these two files may be in a completely different projection and CRS. I am trying to use the following python code ...
88 views

### Changing inline variable %name% in ModelBuilder of ArcMap

I have a lot of MODIS tif files in a folder and I want to calculate zonal statistics of each tiff file according to polygon in my shapefile. I am trying this in ModelBuilder of ArcMap 10.3.1 However, ...
50 views

### Zonal Statistics results are Null in QGIS

I am relatively new to QGIS and I am having issues with Zonal Statistics. I keep receiving NULL as my results for the median. I am trying to create a map displaying the median temperature for each ...
375 views

### Zonal statistics error in arcpy

I'm trying to get the zonal statistics output (mean), do some operations and add to my main archive the output value. I wrote this code, but it's not running, the error message is: Traceback (most ...
4k views

### Using GeoPandas with rasterstats for zonal statistic gives error

I'm trying to use GeoPandas and zonal statistic from rasterstats together. I run this code import geopandas as gpd from rasterstats import zonal_stats geodf = gpd.read_file("SHP/shape.shp&...
59 views

### Reducing image resolution to sum using Google Earth Engine JavaScript API

How do I accurately reduce the resolution of an image with a global extent by summing values in GEE and then export to drive? I am trying to export this global forest carbon potential dataset (...
37 views

### Include two iterators in ModelBuilder to use zonal statistics as table

I am facing a problem because I know is not possible to include 2 iterators in the same ModelBuilder model. I have 10 features (polygons) in a shapefile and 1000 rasters in a folder. I want to ...
99 views

### Calculating number of pixels of dominant class in QGIS

I have a land use classification raster file and a grided (5 km² grids) shapefile of my study region. I want to compute a landscape complexity index (LC) which can be computed by: LC = number of ...
1k views

### Generating zonal stats for multiple rasters using rasterstats

I'm trying to generate the zonal stats for multiple rasters without using ArcPy. I've successfully obtained results using rasterstats for one image and one polygon. I would like to use the same ...
46 views

### Landcover image coverage of each class in study area

I want to define a dictionary with landcover type and their coverage in my study area. I wrote the code as below, but it is not working as I want. How can I define a dictionary or another datatype to ...
1 vote
113 views

### Looping grouped reductions using ImageCollections and FeatureCollections in Google Earth Engine

Using an example from Google Developers (Grouped Reductions and Zonal Statistics), I was able to write a script that calculates burned area within land cover classes of a national forest... link to ...
30 views

### Reading values from file Geodatabase table and assigning those values to variable [closed]

I created a table using the zonal statistics as a table tool which contains some percentile values of a raster (90%, 75%, etc). The table is 1 row and contains the percentile values. I want to take ...
287 views

### Getting zonal statistics of polygons not touching center raster cells in PostGIS?

I'm working a postgis processing zonal stats from raster and I couldn't manage the problem of raster with so low resolution (like 9km width) and small polygons. My problem is, these rasters are big (...