ST_AddMeasure

更新时间:
复制 MD 格式

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

ParameterTypeDescription
geomMlinegeometryThe LineString geometry to add measure values to.
measureStartfloat8The minimum m coordinate that is allowed.
measureEndfloat8The 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)