Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
A class to represent a Geometry value in Python.
Syntax
from pyspark.databricks.sql.types import Geometry
Geometry(wkb=<wkb>, srid=<srid>)
Parameters
| Parameter | Type | Description |
|---|---|---|
wkb |
bytes | The bytes representing the WKB of Geometry |
srid |
integer | The integer value representing SRID of Geometry |
Methods
| Method | Description |
|---|---|
getBytes() |
Returns the WKB of Geometry |
getSrid() |
Returns the SRID of Geometry |
Examples
from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([{'geomwkt': 'POINT(17 7)'}])
g = df.select(dbf.st_geomfromwkt(df.geomwkt).alias("geom")).head().geom
g.getBytes().hex()
'010100000000000000000031400000000000001c40'
from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([{'geomwkt': 'POINT(17 7)'}])
g = df.select(dbf.st_geomfromwkt(df.geomwkt).alias("geom")).head().geom
g.getSrid()
0