st_dimension
Preview
This feature is in Public Preview. You can confirm preview enrollment on the Previews page. See Manage Databricks previews.
Returns the topological dimension of the 2D projection of the input geometry.
For the corresponding Databricks SQL function, see st_dimension function.
Syntax
Python
from pyspark.databricks.sql import functions as dbf
dbf.st_dimension(col=<col>)
Parameters
Parameter | Type | Description |
|---|---|---|
|
| A Geometry value. |
Examples
Python
from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([('MULTIPOINT(EMPTY,-1 0,EMPTY)',)], ['wkt'])
df.select(dbf.st_dimension(dbf.st_geomfromtext('wkt', 4326)).alias('result')).collect()
Output
[Row(result=0)]
Python
from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([('LINESTRING(-1 0,0 -1,1 0,0 1,-1 0)',)], ['wkt'])
df.select(dbf.st_dimension(dbf.st_geomfromtext('wkt')).alias('result')).collect()
Output
[Row(result=1)]
Python
from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([('MULTIPOLYGON(EMPTY,((-1 0,0 -1,1 0,0 1,-1 0)))',)], ['wkt'])
df.select(dbf.st_dimension(dbf.st_geomfromtext('wkt')).alias('result')).collect()
Output
[Row(result=2)]
Python
from pyspark.databricks.sql import functions as dbf
from pyspark.sql.functions import unhex
df = spark.createDataFrame([('0107000020e610000000000000',)], ['ewkb'])
df.select(dbf.st_dimension(dbf.st_geomfromewkb(unhex('ewkb'))).alias('result')).collect()
Output
[Row(result=0)]