地理
Python で地理値を表すクラス。
構文
Python
from pyspark.databricks.sql.types import Geography
Geography(wkb=<wkb>, srid=<srid>)
パラメーター
パラメーター | Type | 説明 |
|---|---|---|
| バイト | 地理のWKBを表すバイト |
| integer | 地理のSRIDを表す整数値 |
方法
手法 | 説明 |
|---|---|
| 地理のWKBを返します |
| 地理のSRIDを返します |
例
Python
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()
Output
'010100000000000000000031400000000000001c40'
Python
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()
Output
4326