[postgis-users] Distance_Sphere Function with Point and Multiline

Kevin Neufeld kneufeld at refractions.net
Fri Sep 28 10:15:46 PDT 2007


Reichle, Florian wrote:
> Hi,
>
> I want to know how can I use the Distance_Shere with Point and Line? 
How about using "ST_line_locate_point(LineString, Point)" to get the 
percentage along your line where the point and linestring are closest.

Then pass the result into "ST_line_interpolate_point(linestring, 
location)" to extract the actual point location on your line.

Finally, use "ST_distance_sphere(point, point)" to find the distance 
between two points (the result of line_interpolate_point and your 
original point).

-------------
Kevin Neufeld
Software Developer
Refractions Research Inc.
300-1207 Douglas St.
Victoria, B.C., V8W 2E7

Phone: (250) 383-3022
Email: kneufeld at refractions.net




More information about the postgis-users mailing list