[gdal-dev] calculate raster values within a vector

Emilio Mayorga emiliomayorga at gmail.com
Wed Aug 26 10:40:35 EDT 2009


Jose,

Thanks for your pointer to your web site. Looks like you have some
very interesting and useful code there. I've been trying to do
something similar, though I use raster "zone" grids rather than vector
layers; I'd be happy to share that code, but it's too messy at this
point. I'll write a blog post about it eventually. Having Python
functionality that replicates "zonalstats" would be great, with
histogram extractions thrown in.

Dylan, Starspan has always looked very promising, but last time I
checked it looked abandoned. When I tried to use it over a year ago,
it choked on my shapefiles and said they had many invalid geometries
(it had been exported from an arc coverage using the old command-line
ArcInfo), so I gave up after trying to identify the problems. Still,
having Starspan functionality within Python would be great.

Cheers,

-Emilio Mayorga
Applied Physics Laboratory
University of Washington
Box 355640
Seattle, WA 98105-6698  USA
http://staff.washington.edu/emiliom/

On Wed, Aug 26, 2009 at 7:13 AM, Jose Gomez-Dans<jgomezdans at gmail.com> wrote:
> Hi,
>
> 2009/8/20 questions anon <questions.anon at gmail.com>
>>
>> Can anyone get me started on a script that can -
>>
>>  -Open a shapefile
>>
>>  -Open many rasters
>>
>>  -Calculate the mean and standard deviation of those rasters within the
>> shapefile region, but is able to ignore areas of zeros or NoData
>>
>>  -Output the mean and standard deviation to a table
>
> i've done a similar example to what you want here:
> < http://sites.google.com/site/spatialpython/aggregating-data-to-grid-cells>
> Only difference is that I calculate the histogram, rather than just the mean
> and std dev. It is trivial to modify this for your own purposes. In fact,
> when I get some time, I'll throw in a full "zonal stats" class, but for now
> this should get you started.
>
> J
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>


More information about the gdal-dev mailing list