ST_LineLocatePoint
Updated at:
Returns a float between 0 and 1 representing the location of the closest point on a LineString to a given point, as a fraction of the total line length.
Syntax
float8 ST_LineLocatePoint(geometry aLinestring , geometry aPoint);
float8 ST_LineLocatePoint(geography aLinestring , geography aPoint);
Parameters
Parameter |
Description |
aLinestring |
The target LineString object. |
aPoint |
The target Point object. |
Description
This function is useful for approximating address numbers.
Example
SELECT ST_LineLocatePoint('LINESTRING(0 0,0 2)'::geometry, 'POINT(1 1)'::geometry);
st_linelocatepoint
--------------------
0.5
(1 row)
-- geography
SELECT ST_LineLocatePoint('LINESTRING(0 0,0 2)'::geography, 'POINT(1 1)'::geography);
st_linelocatepoint
--------------------
0.5000746195163556
(1 row)
Is this page helpful?