ST_CoordDim

Determine the number of coordinate dimensions the geometry.

Syntax

ST_CoordDim(geo);
geo
The input geometry.

Type: ST_GEOMETRY(ANY)

Returns

A value of type INT that indicates the number of coordinate dimensions:
2
The geometry has only x and y coordinates, or the geometry is empty.
3
The geometry has x and y coordinates, and additionally has either a z or m coordinate.
4
The geometry has x, y, z, and m coordinates.

Examples

SELECT inza..ST_CoordDim(inza..ST_WKTToSQL('POINT (0 0)'));

ST_COORDDIM
-----------
2
(1 row)
SELECT inza..ST_CoordDim(inza..ST_WKTToSQL('POINT (0 0 0)'));

ST_COORDDIM
-----------
3
(1 row)