[gdal-dev] Zonal statistics with GDAL/StarSpan

Greg Ederer greg at ergonosis.com
Thu Dec 18 14:32:30 EST 2008


Hi Brent,

Thanks for the example.  Here's what I got:

Macintosh-4:starspan_tests gregederer$ starspan2 --progress --RID none 
--vector 
/Users/gregederer/servers/geoserver_data/data/shapefiles/Admin/afadmn2n.shp  
--raster rfe_2006_04_pct.tif --stats  results.txt avg
starspan: --out-prefix: ?
Type `starspan --help' for help

I then added a --out-prefix, like so:

Macintosh-4:starspan_tests gregederer$ starspan2 --progress --RID none 
--vector 
/Users/gregederer/servers/geoserver_data/data/shapefiles/Admin/afadmn2n.shp  
--raster rfe_2006_04_pct.tif --stats  results.txt avg --out-prefix bar
starspan: --out-type: ?
Type `starspan --help' for help

I then added '--out-type table' (I found in the source that valid 
--out-types are: table, mini_raster_strip, mini_rasters, rasterization):

Macintosh-4:starspan_tests gregederer$ starspan2 --progress --RID none 
--vector 
/Users/gregederer/servers/geoserver_data/data/shapefiles/Admin/afadmn2n.shp  
--raster rfe_2006_04_pct.tif --stats  results.txt avg --out-prefix bar 
--out-type table
Number of features: 550
starspan_csv:   1: Extracting from rfe_2006_04_pct.tif
        0% terminate called after throwing an instance of 
'geos::util::TopologyException'
  what():  TopologyException: side location conflict -8.25 23.1536
Abort trap

Any idea what the TopologyException indicates?

Thanks!

Greg

Brent Fraser wrote:
> 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
>>


-- 
| E R G O N O S I S
| Greg Ederer
| Lead Developer
| greg at ergonosis.com
| 360.774.6848
|



More information about the gdal-dev mailing list