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).

Filter by
Sorted by
Tagged with
1 vote
0 answers
16 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 ...
user avatar
2 votes
0 answers
27 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-...
user avatar
  • 11.7k
1 vote
1 answer
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 &...
user avatar
1 vote
0 answers
24 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 ...
user avatar
0 votes
0 answers
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 ...
user avatar
  • 187
0 votes
0 answers
35 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 ...
user avatar
  • 61
1 vote
1 answer
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 ...
user avatar
0 votes
1 answer
39 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 ...
user avatar
1 vote
0 answers
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. ...
user avatar
1 vote
0 answers
48 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 ...
user avatar
  • 814
0 votes
2 answers
118 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 ...
user avatar
2 votes
1 answer
119 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 ...
user avatar
  • 51
0 votes
1 answer
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 ...
user avatar
0 votes
1 answer
48 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 ...
user avatar
0 votes
0 answers
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. ...
user avatar
1 vote
1 answer
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 ...
user avatar
0 votes
0 answers
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 ...
user avatar
0 votes
0 answers
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 ...
user avatar
  • 1,139
2 votes
1 answer
186 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 ...
user avatar
0 votes
0 answers
70 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 ...
user avatar
2 votes
1 answer
87 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, ...
user avatar
0 votes
0 answers
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 ...
user avatar
  • 9
2 votes
3 answers
181 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 ...
user avatar
  • 51
0 votes
0 answers
58 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 (...
user avatar
  • 765
0 votes
1 answer
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 ...
user avatar
  • 209
3 votes
1 answer
96 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 ...
user avatar
0 votes
1 answer
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 ...
user avatar
  • 97
1 vote
1 answer
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 ...
user avatar
0 votes
1 answer
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 ...
user avatar
  • 109
0 votes
1 answer
56 views

Error in combining feature id, date and mean NDVI value parameters for export in GEE

What I need is to add Point, Object and Date Ids to the before NDVI Mean value. Such that when I export my feature collection it has the point id(Objectid), date id, and mean NDVI parameters. These ...
user avatar
  • 162
3 votes
1 answer
1k views

"ValueError: negative dimensions are not allowed" when using raster created from NetCDF

My code creates a geoTiff from a NetCDF and then I'm trying to compute zonal_stats() from a raster file I created from a NetCDF. I end up getting ValueError: negative dimensions are not allowed at the ...
user avatar
  • 289
0 votes
0 answers
46 views

Want to calculate percent cover of land use categories within buffer areas?

I have point data and a land use map. I created 100m buffers around each point, I now want to calculate the percentage of cover represented by each land use category detected within the buffers. Would ...
user avatar
1 vote
1 answer
146 views

Getting output from reducer (frequency histogram) for every polygons in feature collection using Google Earth Engine

Context: I'm trying to calculate forest cover for each districts in a province. I used the reducer function (frequency histogram) on a raster, using a feature collection object as its "cookie ...
user avatar
0 votes
1 answer
54 views

How Rasterstats function works

I would like to know how the zonal_stats() function from the library rasterstats works, as I am calculating the mean values of a raster within a polygon. If a raster cell touches partially the polygon ...
user avatar
0 votes
0 answers
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 ...
user avatar
-1 votes
1 answer
69 views

ZonalStatisticsAsTable misses 245 polygons out of 3108! using ArcPy with ArcGIS Pro

I have many .ncf files that I read as raster layers and then do zonal statistics to have mean and sd values over each of 3108 CONUS counties. But the final standalone table is missing 245 counties. ...
user avatar
  • 121
0 votes
0 answers
28 views

Optimize zonal statistics to calculate overlapping polygons (1 input FC, 2 rasters)

For my analysis I am using zonal statistics (arcpy) to calculate the elevation and slope statistics of about 12k overlapping administrative boundaries. The boundaries are located in one Feature Class, ...
user avatar
  • 477
2 votes
1 answer
305 views

Zonal Histogram - Python

My main goal is to get the percentage of vegetation cover of gardens. The figure below shows the gardens (orange borders) with vegetation and non-vegetation. I want for each garden the percentage of ...
user avatar
0 votes
1 answer
370 views

Daily Rainfall data extraction from CHIRPS database for polygons using Google Earth Engine

I don't use GEE a lot but I have to use it to extract daily rainfall data from the CHIRPS database. It should be simple but I am stuck. The outcome should be one CSV file with three columns: polygon ...
user avatar
  • 105
1 vote
0 answers
93 views

NetCDF in QGIS --constructing time series using 1368 bands

I have the NetCDF file that contains monthly gridded temperature from 1900 to 2014 (air.mon.mean.v501.nc). The goal is to extract monthly time series for every polygon in my shapefile. Using the US ...
user avatar
  • 11
1 vote
1 answer
56 views

"AttributeError: 'QgsZonalStatistics' object has no attribute 'getFeatures'" when filtering ZonalStatistics result in PyQGIS

I want to calculate zonal stats of a raster using a polygon layer and the filter the ouput as another layer. This is the code I tried: zoneStat = QgsZonalStatistics (tempVectorLyr, rasterLyr, '-', 1) ...
user avatar
0 votes
0 answers
20 views

Continuously receiving NoData as Raster tool output

I'm running ArcGIS Desktop version 10.7. I'm working with a DEM and DSM, both from the same municipal data source (not prepared by me). I am attempting to do some simple analysis on both of these such ...
user avatar
0 votes
0 answers
62 views

Extracting pixel values from dispersed pixels across various countries

I am trying to calculate extreme events of rainfall using ERA-5 Daily Data in Google Earth Engine through Python. I am trying to find pixels that had more rain than the 95th percentile of the previous ...
user avatar
4 votes
1 answer
320 views

Exporting zonal statistics attribute table from QGIS

I have two layers: one is solar radiation, one is town boundaries. I used zonal statistics and seem to have correctly generated that. I'm able to view the attribute table and all seems to be in order. ...
user avatar
2 votes
1 answer
388 views

Extracting mean raster value from buffer around point w/ Google Earth Engine

New GEE user here. I am trying to calculate the mean value of the global human modification (GHM) layer in buffers around points with Google Earth Engine. I'm following this tutorial very closely - ...
user avatar
1 vote
1 answer
360 views

Zonal statistics in R: using exactextractr to extract the counts of a range of pixel values from a raster

I have a raster with pixel values from 0 to 20, and I'm trying to count each pixel value with R package exactextractr. I have the raster ('def'), a SpatialPolygons object ('grid10') and an empty ...
user avatar
2 votes
1 answer
556 views

Counting percentage of raster cell inside polygon using QGIS

I have a raster image that contains a different value and the polygons over the raster's (attached below). Is it possible to calculate the percentage of different cells inside the polygon i.e., 20% ...
user avatar
  • 318
1 vote
1 answer
216 views

Counting of raster cells under polygon using QGIS

I have raster image overlap with shapefile (attached below). Is it possible to count the number of cells with specific value. for i.e., I have a 500 raster cells. 200 raster cells give 1st value and ...
user avatar
  • 318
2 votes
1 answer
120 views

Return whole array from zonal stats

There are some good examples of how to calculate zonal stats using geopandas and Rasterio/GDAL but all of these return a single statistic. Is there a method to return all of the pixel values so that ...
user avatar
1 vote
2 answers
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 ...
user avatar

1
2 3 4 5
10