Skip to main content

st_srid

Preview

Support for GEOGRAPHY values is in Public Preview. Support for GEOMETRY values is generally available.

Returns the SRID of the input geospatial value.

For the corresponding Databricks SQL function, see st_srid function.

Syntax

Python
from pyspark.databricks.sql import functions as dbf

dbf.st_srid(col=<col>)

Parameters

Parameter

Type

Description

col

pyspark.sql.Column or str

A Geography or Geometry value.

Examples

Python
from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([('POINT(10 34)',)], ['wkt'])
df.select(dbf.st_srid(dbf.st_geogfromtext('wkt')).alias('result')).collect()
Output
[Row(result=4326)]
Python
from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([('LINESTRING(1 2,3 4)', '3857',)], ['wkt', 'srid'])
df.select(dbf.st_srid(dbf.st_geomfromtext('wkt', 'srid')).alias('result')).collect()
Output
[Row(result=3857)]