ST_CoordDim

ST_CoordDim takes a geometry column and returns an integer column representing the dimensionality of the coordinates in the input geometry. For example, an input geometry with x,y coordinates only will return 2, while a geometry with x,y,z coordinates will return 3.

FunctionSyntax
Pythoncoord_dim(geometry)
SQLST_CoordDim(geometry)
ScalacoordDim(geometry)

For more details, go to the GeoAnalytics Engine API reference for coord_dim.

This function implements the OpenGIS Simple Features Implementation Specification for SQL 1.2.1.

Examples

PythonPythonSQLScala
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
from geoanalytics.sql import functions as ST, Point

data = [
    (Point(10, 10),),
    (Point(10, 10, 50),),
    (Point(10, 10, 50, 1000),)
]

df = spark.createDataFrame(data, ["point"])

df.select(ST.coord_dim("point").alias("coord_dim")).show()
Result
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
+---------+
|coord_dim|
+---------+
|        2|
|        3|
|        4|
+---------+

Version table

ReleaseNotes

1.0.0

Python and SQL functions introduced

1.5.0

Scala function introduced

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.