[postgis-users] Nearest line from a point

Aurélien FILEZ kinju59 at gmail.com
Sat Aug 20 01:56:24 PDT 2011


Hi,

I have two tables, one which define lines (ST_LineString) and a point
(St_Points).

I'm searching to get the nearest line from this point.

My first solution was to use this type of query :
SELECT
   id,
   St_Distance(line, myPoint) d
FROM
   my_lines_tables
ORDER BY d ASC LIMIT 1

But it's very long. Is there is another way to make this ?

Thank you all,
Kin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20110820/162b17bf/attachment.html>


More information about the postgis-users mailing list