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).
3
votes
QGIS Zonal Statistics by cursor selection
You can use pyqgis to create a function which creates a temporary vector layer of your one selected polygon, executes zonal statistics and print the results if the python console.
Adjust the input lay …
2
votes
Getting the median pixel value for a raster/polygon intersection in PostGIS
For each polygon:
Clip the raster
Convert the pixels to points
Extract the raster values from all points
Then calculate mean value per polygon id with percentile_cont:
SELECT polyid, PERCENTILE_CONT …
2
votes
QGIS Zonal Statistics Crashing
Try to split you layer into subsets then zonal stats using each split layer and merge all the outputs.
(I'm using a point layer just to show the workflow, you need to use your polygon layer)
Field ca …
2
votes
Arcpy - process large shapefile in groups of 100 via cursor
You can use a generator to yield chunks of 100 items at a time from a list of all rows. Then use each chunk to build sql query using the IN operator:
...
def chunks(l, n):
"""Yield successive n-s …
6
votes
Accepted
Zonal Histogram - Python
rasterstats zonal_stats with categorical=True.
For example with pandas so you can manipulate the data as you like:
import geopandas as gpd
import pandas as pd
from rasterstats import zonal_stats
lots …
1
vote
Count area of specific raster value inside polygons
Zonal histogram
Multiply each output column/pixel count with the pixel size (can be found under layer properties) using Field Calcualtor or Refactor Fields
2
votes
Accepted
Splitting a single raster layer into multiple layers based on raster values in QGIS
You dont need to split your raster. Zonal Histogram will create a column for each pixel value with the pixel count.
Appends fields representing counts of each unique value from a raster
layer contain …
1
vote
Zonal Statistics Python Code
Input in Select Layer by Attribute must be a feature layer or a table view. The input cannot be a feature class or table. Make Feature Layer
Your input is "shp" which may be a feature class.
5
votes
Accepted
Reading values from file Geodatabase table and assigning those values to variable
Use da.SearchCursor():
import arcpy
zonetable = r'C:\folder\data.gdb\zonstats' #Change
fieldnames = ['field90', 'field75','field50'] #Change
PER_90, PER_75, PER_50 = [row for row in arcpy.da.SearchC …
5
votes
Accepted
Zonal Statistics is returning null values in ArcGIS Desktop?
You could try resampling the raster to a finer resolution. Not sure why this works but accourding to the help section for version 10.3 (not present in 10.6):
If the zone input is a feature dataset …
2
votes
Accepted
Join a raster (rasterio) with polygons in a GeoDataFrame (zonal statistics)
I recommend using rasterstats.zonal_stats:
import geopandas as gpd
import rasterio
from rasterstats import zonal_stats
rasterfile = r"/home/bera/GIS/data/nh/2021/Jamtland/nh_23_Jamtlands_lan_Sweref_9 …
4
votes
Accepted
Calculating number of pixels of dominant class in QGIS
Use Zonal histogram tool:
Appends fields representing counts of each unique value from a raster layer contained within polygon features.
1
vote
Calculating the majority value pixel in a polygon and the percentage of this value within th...
You dont need batch:
1 Zonal statistics to find the majority value for each polygon:
2 Zonal histogram with the zonal statistics as input to count the number of pixels of each raster class, for each …
0
votes
Calculate weighted raster values per polygon depending on overlap with vector layer
I believe Zonal Statistics is calculating weighted average. Are you sure it doesnt when you use it?
I have a raster with values from 0-100 and a polygon layer with two polygons in it.
The first polygo …
1
vote
Accepted
Calculate area of raster overlap with polygon by raster value, geopandas
Try zonal_stats with categorial and count, then multiply by pixel area:
import geopandas as gpd
import pandas as pd
from rasterstats import zonal_stats
import rasterio
states = gpd.read_file(r'/home/ …