[gdal-dev] calculate raster values within a vector

Jose Gomez-Dans jgomezdans at gmail.com
Wed Aug 26 12:37:39 EDT 2009


Hi,

2009/8/26 Dylan Beaudette <debeaudette at ucdavis.edu>

> ndeed. The current (C++) version of Starspan is more or less unsupported. I
> tend to use an older, stabler, version-- but have become frustrated with it
> in recent studies. I think that the current maintainer Jon Greenberg is
> working on an R implementation-- however I am not certain that this will
> scale well to very large rasters. A Python incantation would be more
> flexible
> than the current C++ version, but perhaps at a speed cost. The current
> version is blazing fast, but there aren't any C++ programmers working on it
> now. If there is sufficient interest, I would like to get it into OSGeo so
> that a more skilled programmer (than myself) can have a look at it.


Python is extremely fast for some of these things. The version I tend to use
< http://sites.google.com/site/spatialpython/zonal-statistics> is bearable
even working with whole landsat scenes. The example there (with one MODIS
1km tile) takes in my laptop:
%timeit S = ZonalStats ( labels_file, data_file, stats='mean') ; std_s =
S.ResampleToGrid("std")
10 loops, best of 3: 1.44 s per loop

%timeit S = ZonalStats ( labels_file, data_file, stats='mean') ; std_s =
S.ZonalStatistics("mean")
10 loops, best of 3: 359 ms per loop


I plan to add a number of refinements to the code, such as adding a vector
input that gets automaticall rasterised, something that the GDAL python
wrappers have allowed for quite some time now, and adding these values to
the output as extra fields, but so far, I have had no need for these, so I
haven't really bothered.

Jose
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20090826/4d6ad3fd/attachment.html


More information about the gdal-dev mailing list