Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Applies to:
Databricks SQL
Databricks Runtime 17.1 and above
Important
This feature is in Public Preview.
Note
This feature is not available on Databricks SQL Classic warehouses. To learn more about Databricks SQL warehouses, see SQL warehouse types.
Returns the topological dimension of the 2D projection of the GEOMETRY value.
Syntax
st_dimension ( geoExpr )
Arguments
geoExpr: AGEOMETRYvalue.
Returns
Returns the topological dimension of the 2D projection of the input GEOMETRY value.
The expression returns:
- 0, if the input
GEOMETRYvalue is a point or a multipoint. - 1, if the input
GEOMETRYvalue is a linestring or a multilinestring. - 2, if the input
GEOMETRYvalue is a polygon or a multipolygon. - 0, if the input
GEOMETRYvalue is an empty geometry collection. - The maximum dimension of elements of the collection, if the input is a non-empty geometry collection.
Examples
> SELECT st_dimension(st_geomfromtext('MULTIPOINT(EMPTY,-1 0,EMPTY)'));
0
> SELECT st_dimension(st_geomfromtext('LINESTRING(-1 0,0 -1,1 0,0 1,-1 0)'));
1
> SELECT st_dimension(st_geomfromtext('MULTIPOLYGON(EMPTY,((-1 0,0 -1,1 0,0 1,-1 0)))'));
2
> SELECT st_dimension(st_geomfromtext('GEOMETRYCOLLECTION EMPTY'));
0