Returns a smallint encoding the coordinate dimension model of a geometry. Return values: 0 = 2D, 1 = 3D-M, 2 = 3D-Z, 3 = 4D.
Syntax
smallint ST_Zmflag(geometry geomA);Parameters
| Parameter | Description |
|---|---|
geomA | The geometry to inspect. |
Description
Use ST_Zmflag to detect whether a geometry carries Z (elevation) coordinates, M (measure) coordinates, both, or neither—before passing it to a pipeline, spatial analysis, or coordinate transformation.
Supports 3D objects. Z coordinates are preserved. The function reads the ZM flag without modifying the geometry.
Circular strings and curves are supported.
Examples
The following examples show the return values for different types of geometry objects:
SELECT ST_Zmflag('POINT(0 1)'::geometry) as _2D,
ST_Zmflag('POINTM(0 1 2)'::geometry) as _3DM,
ST_Zmflag('POINT(0 1 2)'::geometry) as _3DZ,
ST_Zmflag('POINT(0 1 2 3)'::geometry) as _4D;
_2d | _3dm | _3dz | _4d
-----+------+------+-----
0 | 1 | 2 | 3
(1 row)