QGIS Area Statistics

Is there an open source alternative for the Zonal Statistics tool (ArcGIS Spatial Analyst)? What is the best tool (that I can use in a script) to dor count raster file statistics?

+5
source share
4 answers

You can do this with GRASS using various methods. Which one is most suitable will depend on your data and the required performance. Note that you can also use GRASS from QGIS using the GRASS toolbox or the Sextante toolkit.

Suppose you have:

  • , , vector_zones , myzones .
  • , .

r.statistics

r.statistics, , v.to.rast. r.statistics .

v.to.rast input=vector_zones output=zones column=myzones
r.statistics base=zones cover=values out=outputmap method=average

, , , , .. (. ).

r.univar

r.univar .

v.to.rast input=vector_zones output=zones column=myzones    
r.univar map=values zones=zones output=output.file fs=;

.

v.rast.stats

, ( ). (cat) .

v.rast.stats vector=vector_zones layer=1 raster=values column_prefix=val

.

+3

R

library(raster)
v <- raster('raster filename')
z <- raster('zones raster filename')
zv <- zonal(v, z, fun=mean)
+2

, , RobertH, , () , "" , , . R sp (. "-" ), , , . SpatialGridsDataFrames, , sp . , , , " " R .

, , GRASS / QGIS, QGIS (1.7), .

+1

All Articles