ST_AddMeasure

Updated at:

Interpolates m-coordinate values linearly along a geometry object within a specified measure range, and returns the updated geometry.

Syntax

geometry ST_AddMeasure(geometry geomMline, float8 measureStart, float8 measureEnd)

Parameters

ParameterTypeDescription
geomMlinegeometryThe LineString object that you want to specify.
measureStartfloat8The minimum m coordinate that is allowed.
measureEndfloat8The maximum m coordinate that is allowed.

Usage notes

  • This function supports only MultiLineString objects.

  • If the input geometry has no m dimension, an m dimension is added.

  • If the input geometry already has an m dimension, the existing m-coordinate values are overwritten.

  • 3D geometries are supported. The z-coordinate values are preserved.

Examples

Add m-coordinate values ranging from 1 to 2 to a 2D LineString:

SELECT ST_AsText(ST_AddMeasure('LINESTRING(1 0, 2 0)'::geometry,1,2));

Output:

         st_astext
----------------------------
 LINESTRING M (1 0 1,2 0 2)
(1 row)