5. Geospatial Functions : LRS-related Functions : Locate_Along
 
Share this page                  
Locate_Along
LOCATE_ALONG(g Geometry, float f1, float f2);
Alias: ST_LOCATE_ALONG
Returns a point collection of all points in argument g that has an M ordinate equal to f1. If a g is passed without M ordinates the points are calculated with a starting point of 0 and ending point of 1.0. If f2 is non-zero, the result is offset by that value.
The first argument g must be of type Point, PointZ, PointM, PointZM, MultiPoint, MultiPointZ, MultiPointM, MultiPointZM, Linestring, LinestringZ, LinestringM, LinestringZM, MultiLinestring, MultiLinestringZ, MultiLinestringM, or MultiLinestringZM.
The second argument f1 is the measure M that you are trying to match in argument g. If a geometry without M is passed in g, M is calculated for that argument.
The third argument f2 is how much you want to offset the result geometry from its original value.
Result type: MultiPointM or MultiPointZM if g has a Z ordinate.
Example:
SELECT ASTEXT(LOCATE_ALONG(GEOMFROMTEXT('LINESTRINGM(0 0 0, 5 5 5, 10 10 10)'), 5, 0));
-------------
col1
-------------
MULTIPOINT M(2 2 2)
-------------
SELECT ASTEXT(LOCATE_ALONG(GEOMFROMTEXT('MULTILINESTRINGM((2 3 4, 1 4 5, 4 6 6), (5 7 8, 4 6 5, 1 4 2))'), 5, 0));
-------------
col1
-------------
MULTIPOINT M(1 4 5, 4 6 5)