メインコンテンツまでスキップ

st_ndims function

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

Preview

Support for GEOGRAPHY values is in Public Preview. Support for GEOMETRY values is generally available.

注記

This feature is not available on Databricks SQL Classic warehouses. To learn more about Databricks SQL warehouses, see SQL warehouse types.

Returns the coordinate dimension of the input GEOGRAPHY or GEOMETRY value.

Syntax

st_ndims ( geoExpr )

Arguments

  • geoExpr: A GEOGRAPHY or GEOMETRY value.

Returns

A value of type INT, representing the coordinate dimension of the input GEOGRAPHY or GEOMETRY value.

The function returns NULL if the input is NULL.

Examples

SQL
-- Returns the number of dimensions of a 2D point geometry.
> SELECT st_ndims(st_geomfromtext('POINT(10 34)'));
2
-- Returns the number of dimensions of a 3D point geometry.
> SELECT st_ndims(st_geomfromgeojson('{"type":"Point","coordinates":[10,34,55]}'));
3
-- Returns the number of dimensions of a 3D point geography.
> SELECT st_ndims(st_geogfromtext('POINT M (10 34 48)'));
3
-- Returns the number of dimensions of a 4D point geography.
> SELECT st_ndims(st_geogfromtext('POINT ZM (10 34 48 -24)'));
4