Was this helpful?
Line_Locate_Point
LINE_LOCATE_POINT(g Geometry, p Point);
Alias: ST_LINE_LOCATE_POINT
Calculates where on line g a point p lies or interpolates it onto the line, then returns the fraction of distance from the start point as a measurement.
The first argument g must be of type Linestring, LinestringZ, LinestringM, or LinestringZM.
The second argument p must be of type Point, PointZ, PointM, or PointZM.
Result type: float
Example:
SELECT LINE_LOCATE_POINT(GEOMFROMTEXT('LINESTRING(0 0, 5 5, 10 10)'), GEOMFROMTEXT('POINT(5 5)'));
-------------
col1
-------------
0.500
-------------
SELECT LINE_LOCATE_POINT(GEOMFROMTEXT('LINESTRING(0 0, 5 5, 10 10)'), GEOMFROMTEXT('POINT(2 3)'));
-------------
col1
-------------
0.250
-------------
Last modified date: 08/28/2024