Geografi

Kelas untuk mewakili nilai Geografi di Python.

Sintaksis

from pyspark.databricks.sql.types import Geography

Geography(wkb=<wkb>, srid=<srid>)

Parameter-parameternya

Parameter Tipe Deskripsi
wkb Byte Byte-byte yang mewakili WKB Geografi
srid bilangan bulat Nilai bilangan bulat yang mewakili SRID Geografi

Metode

Metode Deskripsi
getBytes() Mengembalikan WKB Geografi
getSrid() Mengembalikan SRID dari Geografi

Examples

from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([{'geogwkt': 'POINT(17 7)'}])
g = df.select(dbf.st_geogfromwkt(df.geogwkt).alias("geog")).head().geog
g.getBytes().hex()
'010100000000000000000031400000000000001c40'
from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([{'geogwkt': 'POINT(17 7)'}])
g = df.select(dbf.st_geogfromwkt(df.geogwkt).alias("geog")).head().geog
g.getSrid()
4326