[gdal-dev] Zonal statistics with GDAL/StarSpan

Brent Fraser bfraser at geoanalytic.com
Thu Dec 18 13:59:48 EST 2008


Greg,

  I've used StarSpan to do similar things; in my case I wanted "mode" not "avg".  Using v1.2.01 (I don't think I made major mods to the source):

	starspan2.exe --progress --RID none --vector boundaries.shp  --raster big.tif --stats  results.txt mode

I edited the resulting results.txt text (csv) file and used GDAL's ogr2ogr to do a join on the shapefile's DBF file based on the FID.

Brent Fraser


Greg Ederer wrote:
> Hello all,
> 
> I'm a GDAL newbie.  I have a shape file containing subnational 
> boundaries for Africa.  I have a raster containing rainfall for Africa.  
> I need to pull out the spatial average of rainfall for each of the 
> subnational units.
> 
> I think that I might be able to pull this off using StarSpan.  But, the 
> docs on the StarSpan wiki do not line up with the current version of the 
> program (the changelog mentions that certain command line switches have 
> been eliminated, and others added; but it doesn't say what the new 
> switches do, or how to use them).  I am digging through the StarSpan 
> sources to try to figure out how to use it.
> 
> Does anyone have any suggestions as to how I might get the needed data 
> using GDAL (with, or without StarSpan)?
> 
> Thanks!
> 
> Greg
> 


More information about the gdal-dev mailing list