ST_DIMENSION()

All functions > GEOSPATIAL > ST_DIMENSION()

Returns the topological dimension of a geometry or geography.

Signatures

Dimension

Returns: Dimension: 0 for points, 1 for lines, 2 for polygons

ST_DIMENSION(geo: T) → BIGINT
sql
ParameterTypeRequiredDescription
geoTYesGeometry or geography value

With:

  • T : Custom types: GEOM_POINT | GEOM_LINESTRING | GEOM_POLYGON | GEOM_MULTIPOINT | GEOM_MULTILINESTRING | GEOM_MULTIPOLYGON | GEOM_MULTIANY | GEOG_POINT | GEOG_LINESTRING | GEOG_POLYGON | GEOG_MULTIPOINT | GEOG_MULTILINESTRING | GEOG_MULTIPOLYGON | GEOG_MULTIANY

Signature notes:

  • Point/MultiPoint returns 0
  • LineString/MultiLineString returns 1
  • Polygon/MultiPolygon returns 2
  • GeometryCollection returns the maximum dimension of its children
  • Returns NULL if the input is NULL

Availability

StatusBackends
Not availableclickhouse, mysql

Examples

FeatureQL
RETURN
    -- Point is dimension 0
    f1 := ST_DIMENSION(ST_GEOMPOINT(1.0, 2.0))
;
Result
f1 BIGINT
0