Questions tagged [rasterstats]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
7
votes
2answers
542 views

Is there an open-source equivalent of ArcGIS “Zonal Statistics as Table” tool?

With ArcGIS zonal statistics as a table I can easily calculate the mean value from a raster contained within a polygon from a shapefile. I now have a Mac, and therefore I cannot access ArcGIS anymore. ...
7
votes
1answer
1k views

Weighted zonal statistics in Python and/or R [closed]

I have raster files with precipitation data (4x4 km), monthly, for about 100 years. I have a shapefile for a watershed (which includes several polygons as sub-basins). I need the average precipitation ...
6
votes
1answer
877 views

Calculating average pixel value for each band across multiple raster layers?

I have a set of raster files that are essentially data sets of precipitation across a region. I have multiple raster files that are the outputs of different climate models. Each pixel in the raster ...
5
votes
2answers
4k views

How to calculate raster statistics for each values in a band?

I have one raster scene that contains one band with multiple pixel values (0-14). Each values represent deforestation in certain year (0=no tree cover loss, 1=loss in 2001, 2=loss in 2002, and so on) ...
5
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
1answer
316 views

Which affine format to use in Rasterstats zonal_stats?

I am working with the Rasterstats package to run zonal statistics on two raster datasets. The documentation calls for the following: import rasterio from rasterstats import zonal_stats with rasterio....
3
votes
1answer
154 views

No data pixels in raster file

I have a TIFF file and I'm trying to use rasterstats to get statistics of different geometries defined in a shapefile or a TopoJSON file. But I'm getting the count as 0 for all the geometries. My ...
3
votes
1answer
668 views

How to compute zonal statistics fast?

I have 12000 circles with a radius of 50 miles on a raster with 0.05 degree resolution. Global analysis. The raster is 32 bit float and I have to calculate zonal statistics for 20 different rasters. ...
3
votes
0answers
240 views

Memory errors when doing Zonal Statistics on a multi polygon shapefile in Python

I want to calculate the mean NDVI with the EthNdvi.tif file for each zone (there are around 650 admin zones) in the the woreda shapefile. I'm having some issues with running the following lines of ...
3
votes
0answers
71 views

On-the-fly zonal statistics in QGIS

I would like to know if there is a plugin/method in QGIS to calculate zonal statistics (mean, median, range, max, min etc.) of a raster file, corresponding to a polygon that I draw/highlight in QGIS. ...
2
votes
1answer
455 views

Using zonal_stats with python in QGIS to calculate statistics for each image

I work with Python in QGIS, I want to calculate statistics for each image that I have with a specify shapefile and save result after, I tried to do like this: from rasterstats import zonal_stats ...
2
votes
1answer
338 views

How to generate zonal stats for multiple rasters using rasterstats Python

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 ...
1
vote
1answer
79 views

How to extract max elevation values for each road links in a shapefile using Python libraries?

I want to extract values from a raster DEM file for each feature (polyline) in a shapefile. For each feature in a road shapefile, I want to extract the max and min elevation within a buffer (say 10 ft)...
1
vote
1answer
41 views

How do I build a new raster based on raster stats in QGIS?

I want to create a new raster that uses the mean value of the original raster as the base class of the image and then uses a +- 1 and 2 standard deviations as the other four classes of the image. Is ...
1
vote
0answers
94 views

Raster Zonal Statistics for large files

I have a shapefile that consists of 375m x 375m cells from the State of California, consisting of a total of 3,022,037 cells. The raster file covers the same geographical area, but consists of smaller ...
1
vote
0answers
46 views

Raster statistic

i'm try to use QGIS processing modeler but I've a problem. I need to use the Mean value and the standard deviation in raster calculator algorithm. I've calculated it in raster statistics, how can I do ...
1
vote
0answers
359 views

Faster zonal stats for equal rasters with Python

I'm trying to extract data out of many raster images with different bounding boxes. Using the great rasterstats.zonal_stats it's a good approach, but it takes a considerable amount of time, especially ...
1
vote
0answers
353 views

How to open memory data with ogr in rasterstats function?

I would like to reuse vector data created in memory in another function called rasterstats (source code, documentation): I have a function that creates vector data: def createPolygons: ...
1
vote
0answers
200 views

Qgis not computing raster stats in layer properties - metadata?

I used to check the sum of all values of a raster (to get some volume information) from the layer properties - Metadata - properties tab, where I had directly the figure I was looking for. However, ...
1
vote
0answers
1k views

How to resolve “'NoneType' object is not callable” TypeError when calling rasterstats.zonal_stats from ArcPy script?

I'm attempting to workaround the apparent zonal statistics bug in ArcGIS 10.4 by using rasterstats.zonal_stats. stats = zonal_stats(shapefile_full_path, rast_full_path,0,1,None,None,{'mean','min','...
1
vote
1answer
740 views

Writing geoJson from rasterstats

How would I write a proper geoJson, readable by a GIS, from the results of the rasterstats package? stats = zonal_stats("somePolygons.shp", "someTif.tif", ...
0
votes
1answer
35 views

Using modeled surfaces together to make predictions?

My question is about stacking multiple rasters of predicted surfaces, that have some of the same predictors. For example, if I make a predicted surface using all the terrain attributes as ...
0
votes
1answer
446 views

Calculating Zonal Stacks on imagery with missing pixels

I'm trying to calculate zonal statistics on some imagery that has a bunch of pixels that come out as 0s. This is affecting the mean value for the area, or at least seems to be. I'm using the ...
0
votes
1answer
48 views

Rasterstats in Python with .IMG files

I am currently trying to use zonal_stats of the rasterstats package to get zonal statistics of processed satellite images. The data is stored as .img-format and i have a shapefile containing 1 ...
0
votes
0answers
33 views

zonal_stats results misaligned

I am trying to clip a raster file with a shapefile using zonal_stats. The obtained clipped raster however does not follow the polygon in the shapefile and the clipped raster covers more area than the ...
0
votes
0answers
20 views

Automate exporting raster XMLs

I edit my raster catalogs to get a specific symbology and then I have to manually export the XML. I then load the XML into the mosaic dataset. I can't seem to find a way to automate the process of ...