Returns the point or multipoint geometry containing all elements in a measured geometry where the M coordinate equals the specified measure value.
Syntax
geometry ST_LocateAlong(geometry ageomWithMeasure, float8 aMeasure, float8 offset);Parameters
| Parameter | Type | Description |
|---|---|---|
ageomWithMeasure | geometry | The measured geometry to search. Must include an M component, such as LINESTRINGM, MULTILINESTRINGM, or MULTIPOINTM. Polygon geometries are not supported. |
aMeasure | float8 | The M coordinate value to locate. |
offset | float8 | The lateral offset distance applied to each result point, in the same units as the geometry. A positive value shifts the point to the left of the input line; a negative value shifts it to the right along the input line. |
Usage notes
Pass only geometries that include an M component. Polygon geometries are not supported.
When the specified measure appears at more than one location, the function returns a
MULTIPOINT Mcontaining all matches.A non-zero
offsetshifts each result point to the left or to the right along the input line by the specified distance.
Example
Find all points in a MULTIPOINTM geometry where M equals 3:
SELECT ST_AsText(
ST_LocateAlong(
ST_GeomFromText('MultiPointM((1 2 3),(5 4 3),(4 5 6))'),
3
)
);Result:
st_astext
----------------------------
MULTIPOINT M (1 2 3,5 4 3)
(1 row)Both (1 2 3) and (5 4 3) have M = 3 and are included in the output. The point (4 5 6) has M = 6 and is excluded.
See also
ST_LocateBetween: Returns all geometry elements where the M coordinate falls within a specified range.
ST_InterpolatePoint: Returns the interpolated M value at a specific point along a geometry.