pyspark.sql.functions.st_srid#

pyspark.sql.functions.st_srid(geo)[source]#

Returns the SRID of the input GEOGRAPHY or GEOMETRY value.

New in version 4.1.0.

Parameters
geoColumn or str

A geospatial value, either a GEOGRAPHY or a GEOMETRY.

Examples

>>> from pyspark.sql import functions as sf
>>> df = spark.createDataFrame([(bytes.fromhex('0101000000000000000000F03F0000000000000040'),)], ['wkb'])  # noqa
>>> df.select(sf.st_srid(sf.st_geogfromwkb('wkb')).alias('result')).collect()
[Row(result=4326)]
>>> from pyspark.sql import functions as sf
>>> df = spark.createDataFrame([(bytes.fromhex('0101000000000000000000F03F0000000000000040'),)], ['wkb'])  # noqa
>>> df.select(sf.st_srid(sf.st_geomfromwkb('wkb')).alias('result')).collect()
[Row(result=0)]