ST_Force3DM

更新时间:
复制 MD 格式

Converts a geometry object to a 3DM geometry by adding M coordinates. Z coordinates, if present, are removed from the output.

Syntax

geometry ST_Force3DM(geometry geomA)

Parameters

ParameterDescription
geomAThe input geometry object.

Usage notes

  • If the input geometry has no M coordinates, the M coordinate of each point in the output is set to 0.

  • If the input geometry has Z coordinates, the Z coordinates are removed from the output.

  • Supports circular strings and curves.

Examples

Input with no M or Z coordinates

SELECT ST_AsEWKT(ST_Force3DM(ST_GeomFromEWKT('POINT(1 2)')));

Output:

   st_asewkt
---------------
 POINTM(1 2 0)
(1 row)

Input with Z coordinates (Z is removed)

SELECT ST_AsEWKT(ST_Force3DM(ST_GeomFromEWKT('POINT(1 2 3)')));

Output:

   st_asewkt
---------------
 POINTM(1 2 0)
(1 row)