On Aug 18, 2009, at 1:30 PM, Michael Elsdörfer wrote:

> I'm pretty much a beginner when it comes to GIS, but I think I
> understand the basics - it doesn't seem to hard. But: All these  
> acronyms
> and different libraries, GEOS, GDAL, PROJ, PCL, Shaply, OpenGEO, OGR,
> OGC, OWS and what not, each seemingly depending on any number of  
> others,
> is slightly overwhelming me.
>

Hi Michael,

Yes, it is a bit overwhelming.

> Here's what I would like to do: Given a number of points and a
> linestring, I want to determine the location on the line closest to a
> certain point. In other words, what PostGIS's line_locate_point()  
> does:
>
> http://postgis.refractions.net/documentation/manual-1.3/ch06.html#line_locate_point
>
> Except I want do use plain Python. Which library or libraries should I
> have a look at generally for doing these kinds of spatial calculations
> in Python, and is there one that specifically supports a
> line_locate_point() equivalent?
>
> Thanks for your time.
>
> Michael

I'm not aware of anything out-of-the-box in Python that does the same  
thing as line_locate_point(). I just looked at the PostGIS code -- it  
finds the nearest linestring segment by checking the distance to  
individual nodes and then does a little algebra

http://trac.osgeo.org/postgis/browser/trunk/lwgeom/ptarray.c?rev=2277#L542

Reusing liblwgeom would be nice, in theory, but I think it's very  
dependent on Postgres (and why wouldn't it be?). Too dependent to be  
useful outside the context of a database. A nearest point algorithm  
wouldn't be all that hard to implement in Python and I'm willing to  
help you find a good home for it. Maybe in a Shapely analytic package?

Cheers,

--
Sean

_______________________________________________
Community mailing list
[email protected]
http://lists.gispython.org/mailman/listinfo/community

Reply via email to