Name

ST_CoordDim — Returns the coordinate dimension of the Geometry.

Synopsis

integer ST_CoordDim(bytea Geometry);

Alias

CoordDim, ST_Ndims, Ndims

Description

Returns the coordinate dimension of the Geometry. Values are 2 (X,Y), 3 (X, Y, Z), 4 (X,Y,Z,M) or Null (Empty geometry).

Coordinate Dimensions
2D3DM
Spatial Standards Support
OGC SFS for SQL. 1.1 (1999)OGC SFS for SQL. 1.1.0 (2005)OGC SFS for SQL. 1.2.0 (2006)SQL-MM Part 3
---5.1.3

Examples

SELECT ST_CoordDim(ST_GeomFromText('POINT (0 0)'));
--Result
2

SELECT ST_CoordDim(ST_GeomFromText('POINT (0 0 10)'));
--Result
3

SELECT ST_Ndims(ST_GeomFromText('LINESTRING(0 0 2 -4,5 0 8 -4,10 0 6 -2)'));
--Result
4

SELECT Ndims(ST_GeomFromText('POINT EMPTY'));
--Result
null

Related functions

ST_Dimension