Pular para o conteúdo principal

st_ndims function

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

Preview

This feature is in Public Preview.

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