הערה
גישה לעמוד זה דורשת אישור. אתה יכול לנסות להיכנס או לשנות תיקיות.
גישה לעמוד זה דורשת אישור. אתה יכול לנסות לשנות מדריכים.
Important
This feature is in Public Preview.
Returns the topological dimension of the 2D projection of the input geometry.
For the corresponding Databricks SQL function, see st_dimension function.
Syntax
from pyspark.databricks.sql import functions as dbf
dbf.st_dimension(col=<col>)
Parameters
| Parameter | Type | Description |
|---|---|---|
col |
pyspark.sql.Column or str |
A Geometry value. |
Examples
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()
[Row(result=0)]
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()
[Row(result=1)]
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()
[Row(result=2)]
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()
[Row(result=0)]