[postgis-users] ST_ShortestLine(r.geom, m.geom) confusion - limiting point to nearest line results

Phil James borntopedal at yahoo.co.uk
Mon Nov 21 14:13:33 PST 2011


Hi Chris

You need an inner query that selects the closest line segment and use that geometry in the shortest line query 
Select shrtest line(p.the_geom,nearestgeom.thegeom) from
Points p,
Select  a.*, st_distance(a.the_geom, b.the_geom) as dist from roads a,points b order by dist asc limit 1) as nearestgeom

Hope this is readable as sending from phone.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20111121/21ec8322/attachment.html>


More information about the postgis-users mailing list