This topic describes the ST_AddMeasure function. This function linearly interpolates m coordinates into the specified range of a geometry object and returns a new geometry object.

Syntax

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

Parameters

Parameter Description
geomMline The LineString object that you want to specify.
measureStart The minimum m coordinate that is allowed.
measureEnd The maximum m coordinate that is allowed.

Description

  • If the geometry object that you specify does not have an m dimension, add an m dimension to the geometry object. If the geometry object that you specify has an m dimension, this function overwrites the original m coordinates with the new m coordinates.
  • This function supports only MultiLineString objects.
  • This function supports 3D objects and does not delete z coordinates.

Examples

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)