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

Example 1: Getting the SRID of GEOGRAPHY. >>> from pyspark.sql import functions as sf >>> df = spark.createDataFrame([(bytes.fromhex(‘0101000000000000000000F03F0000000000000040’),)], [‘wkb’]) # noqa >>> df.select(sf.st_srid(sf.st_geogfromwkb(‘wkb’))).collect() [Row(st_srid(st_geogfromwkb(wkb))=4326)]

Example 2: Getting the SRID of GEOMETRY. >>> from pyspark.sql import functions as sf >>> df = spark.createDataFrame([(bytes.fromhex(‘0101000000000000000000F03F0000000000000040’),)], [‘wkb’]) # noqa >>> df.select(sf.st_srid(sf.st_geomfromwkb(‘wkb’))).collect() [Row(st_srid(st_geomfromwkb(wkb))=0)]