Linearly interpolates m coordinates across the specified range for a geometry object and returns the result as a new geometry object.
Syntax
geometry ST_AddMeasure(geometry geomMline, float8 measureStart, float8 measureEnd)Parameters
| Parameter | Type | Description |
|---|---|---|
| geomMline | geometry | The LineString geometry to add measure values to. |
| measureStart | float8 | The minimum m coordinate that is allowed. |
| measureEnd | float8 | The maximum m coordinate that is allowed. |
Usage notes
If the input geometry has no m dimension, the function adds one. If the geometry already has an m dimension, the existing m coordinates are overwritten.
This function supports only MultiLineString objects.
This function supports 3D geometries and preserves z coordinates.
Examples
Add m coordinates to a 2D LineString, interpolating from 1 to 2:
SELECT ST_AsText(ST_AddMeasure('LINESTRING(1 0, 2 0)'::geometry,1,2));
st_astext
----------------------------
LINESTRING M (1 0 1,2 0 2)
(1 row)该文章对您有帮助吗?