5. Geospatial Functions : Dimension
 
Share this page                  
Dimension
DIMENSION(g Geometry)
Alias: ST_DIMENSION
Returns the dimension of g. Dimension depends on the geometry type:
POINT and MULTIPOINT have a dimension of 0.
LINESTRING and MULTILINESTRING have a dimension of 1.
POLYGON and MULTIPOLYGON have a dimension of 2.
Result type: integer
Examples:
SELECT DIMENSION(POINTFROMTEXT('POINT(0 10)'));
-------
col1
-------
0
-------
 
SELECT DIMENSION(MLINEFROMTEXT('MULTILINESTRING((0 0, 5 0, 0 5), (5 5, 0 0))'));
-------
col1
-------
1
-------
 
SELECT DIMENSION(POLYFROMTEXT('POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))'));
-------
col1
-------
2
-------