Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
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).
2
votes
Python: Extract median by polygon from multiple raster files
I read your question before being edited and reopened and it could be preferable to calculate medians for each particular raster instead to use QgsZonalStatistics. So, you can re-write your code as fo …
3
votes
Accepted
Compute zonal statistics for portion of polygons
I tried out the next code with a polygon shapefile (as active layer) where, first, it is produced a "negative" buffer (-10000 m) as memory layer. Afterward, this memory layer is used as difference lay …
2
votes
How to calculate Standard Deviation in Zonal Analysis Using Python
For this situation:
complete code for getting only standard deviation is:
from qgis.analysis import QgsZonalStatistics
mapcanvas = iface.mapCanvas()
layers = mapcanvas.layers()
provider = laye …
3
votes
Automating Zonal statistics in QGIS?
Your code works perfectly but, you cannot visualize changes immediately because it's necessary to add polygonLayer to registry. However, it can be loaded manually.
A simplified version of your code ( …
4
votes
How does QGIS Zonal Statistics handle partially overlapping pixels?
I can handle partially overlapping pixels adapting code (for PyQGIS in QGIS 3) in the answer to this question: Robust Zonal stats in R and QGIS.
import processing
registry = QgsProject.instance()
…
2
votes
Accepted
Looping grouped reductions using ImageCollections and FeatureCollections in Google Earth Engine
I found out a solution mapping your original SE_FireHistory Image Collection as list. As your Fedlands_SE Feature Collection has 316 elements, most of them outside the area of interest, for greatly re …
5
votes
Accepted
Robust Zonal stats in R and QGIS
A Robust Zonal stats in QGIS can be implemented with PyQGIS. Following code was run with your layers by using a filter to select only ID_sub.pat between 19 and 27 (showed in your image).
import proce …
3
votes
Problem with calculating QGIS Zonal Statistics MEAN
For some reason your code is not producing a QgsZonalStatistics object. Print 'zoneStats' to corroborate this. It should be observed some similar to:
<qgis._analysis.QgsZonalStatistics object at 0x9f …
3
votes
Accepted
Compute zonal statistics in QGIS with overlapping features
For computing zonal statistics in PyQGIS with overlapping features you can use 'unary_union' and 'polygonize' methods from shapely python module. For trying out my approach I used next shapefile (with …
2
votes
Locating the maximum values of a raster intersection with a vector of polygons using Python
The rasterstats python module is based in rasterio, however, it has crop = True option activated by default (when I use raster_out = True for getting all unmasked array values) and I couldn't find an …
1
vote
Accepted
QGIS zonalstatisticsfb returns NULL
QGIS calculates NULL because both layers have not the same projection. Layer named isos has EPSG:4326 and BY-AT raster has EPSG:54009 (World_Mollweide-Projected). I got your same result by using these …
2
votes
Landcover image coverage of each class in study area
I followed your code line by line and you don't need to create an image that contains one band with the pixel's area and a second band with the class information. You only need to retrieve both landCo …
1
vote
Determining Min and Max elevation in Python using GDAL?
As it was pointed out by Steven Kay, there's some sample code on the GDAL/OGR cookbook about 'zonal statistics', so it's some extensive when it is compared with the mdsumner's R code. I know that R po …
3
votes
Alternatives to Zonal Statistics which include partial pixels (QGIS)
Zonal Statistics, which include partial pixels, can be performed by using PyQGIS. I tried out PyQGIS code with a small raster (20 rows x 20 columns, pixel size 30 m) and a shapefile with two features …