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
5
votes
3answers
9k views

Iterate through multiple Raster files and compute statistics using Zonal Statistics

I have a large number of raster images. What I'd like to do is to compute statistics on different sections of these raster files using a polygon. I think everyone is suggesting Zonal statistics. ...
14
votes
2answers
2k views

How does QGIS Zonal Statistics handle partially overlapping pixels?

There are a couple Stackexchange posts asking this question, but neither of them were sufficiently answered: How does Zonal Statistics work exactly? How does Zonal statistics handle pixels that are ...
9
votes
3answers
8k views

Using QGIS Zonal Stats Plugin from Python Console?

I am using the Zonal Stats plugin in QGIS to extract raster statistics from overlaying polygons (I have shapefiles of species distribution and I want to extract environmental data from within each ...
26
votes
3answers
4k views

Major bug in ArcGIS Zonal statistics?

Update: The bug has been fixed in the ArcGIS 10.4 release I am using ArcGIS 10.2.2 to determine zonal statistics for a number of zones. If there is any NoData in the value raster, I want the zone ...
10
votes
2answers
13k views

How does Zonal Statistics work exactly?

I'm a bit confused on how the zonal statistics tools work in QGIS (either the 'Zonal Statistics' tool under the Raster tools from the QGIS geoalgorithms toolbox or the 'Raster statistics from polygons'...
6
votes
3answers
2k views

Some zones disappear when running Zonal Statistics as Table in ArcGIS

I'm new to GIS. I want the sum of nighttime lights (DMSP) by district for some country. I'm running this arcpy.gp.ZonalStatisticsAsTable_sa(Limites_distritales, "IDDIST", rc, temp_table, "DATA", "") ...
6
votes
2answers
4k views

Zonal statistics for millions of overlapping polygons in ArcPy?

I am running ArcGIS 10.1 with 64-bit GP on Windows 8.1 x64. I want to calculate the zonal statistics of buffer polygons based on parcels and a kernel density raster. The 4.7 million polygons overlap ...
1
vote
1answer
75 views

Zonal statistics 2 ends up causing a fatal error. Is there an alternative?

I have recently switched to using the "zonal statistics as table- 2" supplemental tool instead of the regular "zonal statistics" because I have overlapping polygons which zonal ...
6
votes
2answers
2k views

How to Calculate Custom Zonal Statistics?

I have a vector polygon shapefile outlining counties for which I have a raster of nighttime-luminosity data. I've been able to compute Zonal Statistics in ArcGIS 10.0 using Zonal Statistics as Table ...
3
votes
1answer
1k views

QGIS equivalent to the ArcMap Zonal Statistics as Table

Is there a QGIS equivalent to the Arc: Spacial Analyst: Zonal: Zonal Statistics as Table? Given the USDA Cropland Data Layer, Would like to count the pixels by type within a county.
6
votes
2answers
2k views

Zonal statistics of polygon overlays in PostGIS

I am trying to do a seemingly simple task -- extract mean pixel values from a raster based on a polygon overlay in PostGIS. I consulted several sources, including this blog, this blog, and this post). ...
9
votes
2answers
2k views

Robust Zonal stats in R and QGIS

Comparing results of zonal statistics in QGIS and R, I noticed that the results they both yield do somehow differ. Manually checking, I also found that both QGIS and R seem to partly produce erroneous ...
8
votes
2answers
6k views

Issue Trying to create Zonal Statistics using Gdal and Python.

I am trying to create zonal statistics using Python and Gdal. I have a polygon shapefile and a raster file, and in order to do so, I am using a piece of code I found in StackExchange. The raster and ...
4
votes
0answers
1k views

Zonal computations: computing raster pixel counts within polygons using GDAL versus rasterstats

I'm computing some zonal statistics, and was comparing the results obtained using the GDAL cookbook example code here with the rasterstats zonal_stats function. I want to compute the mean value per ...
3
votes
2answers
2k views

Plotting and analyzing extracted elevation data in R?

I have a shapefile of county boundaries for New York state and elevation data downloaded through the elevatr package. library(elevatr) library(raster) library(sf) library(USAboundaries) counties <...
3
votes
1answer
1k views

Finding local maxima with variable window search using ArcGIS Desktop?

I would like to find local maxima in different zones of raster file. I got five zones (zone 1, 2,3,4,5) and would like to find local maxima with different window search for each zone in arcgis ...
2
votes
1answer
453 views

Why is WPS execute process in Geoserver producing this error?

I am trying to compute raster zonal statistics using a TIFF and a Shapefile. I am using WPS process extension for GeoServer. I am trying to use the WPS request builder provided by my GeoServer ...
2
votes
1answer
3k views

Using Zonal Statistics As Table for overlapping polygons in ArcPy?

I'm using ArcGIS 10.2 for Desktop and would like to calculate the population within a specific distance from bus stops. My input layers are: census block (polygon) with population undissolved bus ...
0
votes
2answers
2k views

Batch Zonal Statistics as table?

I want to calculate zonal statistics as table for multiple rasters, but can't figure out how. What I am trying is: import arcpy, os arcpy.env.workspace=r'F:\Sheyenne\Atmospherically Corrected ...
4
votes
1answer
6k views

Zonal Statistics of a polygon and assigning mean value to the polygon [closed]

I have a large shapefile filled with polygons, and a raster of that same area. I need to use Zonal statistics to find the mean value of the area under each polygon and then assign that value to the ...
3
votes
2answers
460 views

R zonal statistics for classes

I am trying to extract zonal statistics for different classes in R. I have a raster with two classes (0,1) and need the area (or percentage) of each class under the area of each polygon. I tried ...
9
votes
2answers
1k views

Alternatives to Zonal Statistics which include partial pixels (QGIS)

The task I want to complete is essentially exactly what the Zonal Statistics plugin for QGIS aims to achieve: gives statistics about the values of a raster layer in areas defined by polygons. However,...
6
votes
1answer
608 views

Determining whether raster pixels in or out of zone

I am running ArcGIS 10.2.2 and often use the Zonal Statistics and Tabulate Area Tools. I wanted to confirm that the area of a pixel will only be included in the tabulated area if the pixel centroid is ...
9
votes
1answer
2k views

Geopandas and Zonal Statistic 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&...
4
votes
2answers
3k views

Zonal Statistics for multiple rasters

I'm trying to create a timeseries of raster data (one layer per year) by polygon (Administrative regions). Is there any way in QGIS to perform Zonal Statistics for multiple years (without having to ...
4
votes
1answer
3k views

Calculating NDVI per region, month & year with Google Earth Engine?

I want to calculate the mean NDVI per region (admin level 3, also called woreda), month and year. So my end result would look something like this: regions year month NDVI ------------------...
4
votes
1answer
62 views

Geometry Generator and Zonal Statistics

I am trying to compute population affected by various distances, during earthquake events. The earthquake point events update every minute and I need to find a way how to create automatic buffers and ...
4
votes
3answers
2k views

How can I determine which raster attribute covers the highest area of a polygon?

I'm relatively new to GIS and QGIS but I have a problem that I'm not certain how to solve. I searched here for relevant information but found none. (Or, I used incorrect search terms.) My problem ...
4
votes
2answers
600 views

Clustering 30m pixels into 120m pixels, fishnet using QGIS?

I have a raster file representing tree cover loss made of 30m*30m pixels taking the value 0 or 1. 0 means no loss and 1 means tree cover loss. I want to cluster these pixels into bigger pixels of the ...
3
votes
2answers
207 views

Expected result for ZonalStatisticsAsTable MEAN Statistic Type?

I'm getting different results when using the ZonalStatisticsAsTable tool in 10.4.1 when compared to earlier versions (10.2 and 10.3). ArcGIS 10.2: ArcGIS 10.3: But in ArcGIS 10.4.1, the same data ...
2
votes
1answer
709 views

Running QgsZonalStatistics in PyQGIS script?

I have experienced a very bizarre issue with my PyQgis code. I simply want to load a raster and a vector layer to do zonal statistics, the first part works perfectly but for the zonal statistic I have ...
6
votes
1answer
346 views

Zonal maximum at a specific location

I have 50,000 polygon shapefile, each polygon is a small community. I have a flow accumulation raster. I need to extract just the maximum cell (max flow accumulation) for each polygon. Now if I run ...
5
votes
0answers
304 views

How does Zonal statistics handle pixels that are on border of polygon? [duplicate]

I am using the plugin zonal statistics to calculate the sum of the raster cells within polygons. How does this plugin handle pixels that are on the border of the polygon, are those cell values ...
4
votes
2answers
2k views

QGIS Zonal Statistics returns empty?

Does anyone familiar with the QGIS Zonal Statistics tool know why stats calculations might return empty? Inputs DEM for South Carolina: http://dnr.sc.gov/GIS/descdem.html A vector shapefile: https://...
4
votes
4answers
8k views

How to read this data file and convert it to raster format for analysis?

I am trying to introduce the 5 degree dataset from here http://www.cru.uea.ac.uk/cru/data/precip/ (it is the first link). And once I introduce it to GIS to use it as a raster input to calculate zonal ...
3
votes
1answer
273 views

Zonal stats for complete pixels qgis

I am trying to extract zonal statistics from raster imagery using polygons in QGIS 3.2.1, but I only want to use values from those pixels that are completely included in the polygons, ¿how to do this? ...
3
votes
1answer
431 views

Getting Zonal Statistics of Overlapping Circles?

I have a Buildings (polygon) shp file and a DSM. what I wanted to do was to get the pixel values for all the vertices of those buildings, and find another pixel value just around those vertices (say ...
3
votes
1answer
232 views

Appending 10,000 tables using ArcPy?

I am trying to append ~10,000 tables together using an ArcPy script. I believe the method I am using does not work as the script is attempting to append too many tables at the same time. Would a ...
3
votes
2answers
1k views

Problem with calculating QGIS Zonal Statistics MEAN

I need to calculate some zonal statistics from raster files for some polygons in a shapefile. I am using the following code which works: eligibleLayer = QgsVectorLayer("/home/usr/Desktop/...
2
votes
3answers
544 views

Zonal Statistics as Table Tool

I have a slope dataset. I have a polygon shapefile with territory within the extent of the slope map. I have to calculate the real surface area of this shapefile using the zonal statistics as table ...
2
votes
0answers
803 views

QGIS 2.4 Processing (Zonal Statistics) error [closed]

In QGis 2.2 all my models (processing model builder) are working fine. When I start the same models in 2.4 I get errors like this: Prepare algorithm 5: Zonal Statistics Running Zonal Statistics [...
2
votes
1answer
469 views

Zonal Statistics Freezing QGIS 2.2

Running on Windows; 8gb memory, 500gb HD, i5 cpu; Raster file: 250mb I am having a problem with zonal statistics advancing past 17%. I am trying to run statistics on a crop grown in certain counties. ...
2
votes
2answers
2k views

How does ArcGIS calculate zonal statistics with multi-band rasters?

I am working back and forth between QGIS to ArcGIS for various tasks. So far, for my task, I have found similar tools and options between them. However, for my current task, to calculate the zonal-...
2
votes
1answer
613 views

Polygons too Small for Zonal Statistics

In ArcMap, Zonal Statistics uses the centre points of the Rasters pixels to link to the under or overlying polygons. Some of the polygons that I am using are small enough that they do not overlap ...
2
votes
1answer
564 views

QGIS Zonal Stats Plugin - Python Console - compute one specific statistic

I think this is more of a syntax problem that I have here. But I am absolutely not able to figure it out. On a different Linux machine I got the following working: zoneStat = QgsZonalStatistics (...
2
votes
1answer
134 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: ...
2
votes
0answers
138 views

Zonal sum gives incorrect results [closed]

I have two raster files: Raster 1 has 7974 grids (coarser resolution) with Rowid, Value and Count. Raster 2 is finer resolution and each grid has values either 1 or 0. What I want to do is to find ...
1
vote
1answer
1k views

Writing result of PyQGIS to shapefile

I try to perform some zonal statistics on a shape- and rasterfile and write the output to a completely new shapefile! import sys # where is the module sys.path.append("/Applications/QGIS.app/Contents/...
1
vote
1answer
320 views

Zonal statistics using Python console in QGIS gives AttributeError?

Here is how the log shows for one raster image. I want to do this same thing for several rasters. The batch processing is not working. QGIS version: 3.8.0-Zanzibar QGIS code revision: 11aff65f10 Qt ...
1
vote
1answer
2k views

Python Script Zonal Stats as Table Loop Question

I'm trying to write a small script loop script which retrieves rasters from each folder, performs zonal statistics using watershed polygons and saves it as a table. I've written similar loop scripts, ...