[postgis-users] the nearest point of a line from a point

Kevin Neufeld kneufeld at refractions.net
Wed Jan 30 08:25:39 PST 2008


See the section on linear referencing (sec. 6.2.7). 
(http://postgis.refractions.net/docs/ch06.html#id2775904)

You'll need to use two methods.

ST_line_locate_point(LineString, Point) returns the percentage along the 
the LineString the closest point will occur.

ST_line_interpolate_point(linestring, location) returns the geometric 
point given a LineString and a percentage along.

SELECT ST_line_interpolate_point(line_geom, 
ST_line_locate_point(line_geom, point_geom))
FROM ...

Cheers,
Kevin

sylvain dubouis wrote:
> hello, I have a point and a line.
> I'd like to know the nearest point on the line from the  point.
> but I don't find any function to do this... is there one?
> thanks for your help.
> Sylvain
> ------------------------------------------------------------------------
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>   



More information about the postgis-users mailing list