[Gdal-dev] Using OGR Python to analyse stream layers

Christopher Fonnesbeck chris at fonnesbeck.org
Mon Feb 9 10:01:34 EST 2004


On Feb 9, 2004, at 9:44 AM, Frank Warmerdam wrote:
>
> The OGR Python interface would be fine for accessing stream vectors in 
> any
> OGR supported format (which does not include GRASS at this time).  
> However,
> OGR has no mechanism for finding the nearest feature to a point, or for
> computing the distance betweena feature and a point.  So you would end 
> up
> having to do this yourself in python which could be kind of 
> computationally
> expensive.

Thanks for the advice! What if I had a polygon coverage with affected 
polygons instead; could those then be intersected with a stream 
coverage, or is that outside of OGR's realm?

Is there documentation/examples of how OGR handles line features like 
stream networks?

>
> One slightly exotic solution to your problem might be to keep your 
> network
> data in PostGIS and then use the PostGIS primitives (based on GEOS) to 
> find
> the nearest geometry.  You could use access postgis via OGR's PostGIS 
> driver
> or do the operations directly from Python using ODBC and then use a 
> python
> package to parse the results from PostGIS.  You can request results in 
> WKT
> for instance.  You could use OGR to parse the WKT geometry but there 
> is also
> another "pure python" module available now that understands OGC 
> geometry
> formats that might be even simpler.
>

I presently use MySQL for all my GIS databasing, and version 4 now 
supports storage of spatial features. Is there a mysql driver for OGR?

Thanks again,
Chris

--
Christopher J. Fonnesbeck ( c h r i s @ f o n n e s b e c k . o r g )
Georgia Cooperative Fish & Wildlife Research Unit, University of Georgia




More information about the Gdal-dev mailing list