Pular para o conteúdo principal

st_dimension function

Applies to: check marked yes Databricks SQL check marked yes Databricks Runtime 17.1 and above

Preview

This feature is in Public Preview.

nota

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: A GEOMETRY value.

Returns

Returns the topological dimension of the 2D projection of the input GEOMETRY value. The expression returns:

  • 0, if the input GEOMETRY value is a point or a multipoint.
  • 1, if the input GEOMETRY value is a linestring or a multilinestring.
  • 2, if the input GEOMETRY value is a polygon or a multipolygon.
  • 0, if the input GEOMETRY value is an empty geometry collection.
  • The maximum dimension of elements of the collection, if the input is a non-empty geometry collection.

Examples

SQL
> 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