ST_Dimension¶
Returns the dimension of the geometry.
Usage¶
integer ST_Dimension(geom: geometry)
Arguments¶
- geom (geometry): Input geometry
Description¶
Returns the inherent dimension of the geometry:
- 0 for points or multipoints
- 1 for linestring or multilinestrings
- 2 for polygons or multipolygons
For geometry collections, returns the largest dimension among the components.
Examples¶
SELECT ST_Dimension(ST_GeomFromWKT('POLYGON ((0 0, 1 0, 0 1, 0 0))'));
┌──────────────────────────────────────────────────────────────────────┐
│ st_dimension(st_geomfromwkt(Utf8("POLYGON ((0 0, 1 0, 0 1, 0 0))"))) │
│ int8 │
╞══════════════════════════════════════════════════════════════════════╡
│ 2 │
└──────────────────────────────────────────────────────────────────────┘
SELECT ST_Dimension(ST_Point(1.0, 2.0));
┌───────────────────────────────────────────────┐
│ st_dimension(st_point(Float64(1),Float64(2))) │
│ int8 │
╞═══════════════════════════════════════════════╡
│ 0 │
└───────────────────────────────────────────────┘