[gdal-dev] Best way to test wheter point is contained in Polygon

Jose Gomez-Dans jgomezdans at gmail.com
Thu Sep 25 12:00:57 EDT 2008


Chris, thanks for your comments

2008/9/25 Christopher Barker <Chris.Barker at noaa.gov>

> Perhaps cumbersome, but in fact, at some level, you are indeed doing a
> rasterization with the P-in-P testing, as you are working with ALL the
> pixels in your raster. I bet it would be a lot faster to rasterize the
> polygons once, rather than doing point-in-polygon tests for every single
> raster point.


You are absolutely right. It's just that you have to call external program
such as gdal_rasterize. Is the rasterization stuff supposed to be available
to the Python GDAL bindings? It would make a lot of sense, I guess.

In the end, I ended up rasterising rather than testing each geometry.
Blindingly fast ;)

Cheer,
Jose


-- 
Centre for Terrestrial Carbon Dynamics
Department of Geography, University College London
Gower Street, London WC1E 6BT, UK
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20080925/13bd7f18/attachment.html


More information about the gdal-dev mailing list