samedi 27 décembre 2014

how to Find nearest line for the given point from a collection of lines?


I have table with lines(linestring).For a point wich i give it , I want to find out nearest line in point. I almost developed a query, but it is return the same line every point i give.


the query



SELECT AsText(ST_Line_Interpolate_Point(geom,ST_Line_Locate_Point(geom,ST_Transform(GeomFromText('POINT(LON LAT)',4326),2100))))
FROM roads
WHERE geom && expand(ST_Transform(GeomFromText('POINT(LON LAT)',4326),2100), 100)




Aucun commentaire:

Enregistrer un commentaire