[postgis-users] Select Point near Polyline Postgis

anhtin anhtin at gmail.com
Fri Jun 15 20:18:21 PDT 2007


hi all
I am developing a web application. i am using Mapserver and Postgis 
I have a question below
if i want to click one point on map to select the nearest point on the
nearest polyline from the point i clicked. How can i do?
Notes: The point I clicked is converted to X,Y coordinate (295149 2315499)

could you show me the sql command in postgis.
1. How can i select the nearest  polyline on the click point.
2. How can  i select the the nearest point on the selected nearest polyline.
:computer-user:
:rules:

Somebody suggest that I should search the polyline nearest on the click
point by the script below

SELECT * FROM mainroad WHERE GeomFromText('POINT(517651 2121421)', 42102) &&
the_geom 
 AND distance(the_geom,
GeomFromText('POINT(517651 2121421)', 42102)) < 200000

however,  sometime it has no result because the distance from point to
polyline is larger than 200000.
-- 
View this message in context: http://www.nabble.com/Select-Point-near-Polyline-Postgis-tf3931432.html#a11150683
Sent from the PostGIS - User mailing list archive at Nabble.com.




More information about the postgis-users mailing list