ST_SRID

ST_SRID can work as a getter or a setter, depending on the inputs.

Getter: ST_SRID takes a geometry column and returns the spatial reference ID (SRID) of the column as an integer column. If the SRID of the input geometry column has not been set, the function returns 0.

Setter: ST_SRID takes a geometry column and a numeric value and returns the input geometry column with its SRID set to the numeric value. This does not affect the geometry data in the column. To transform your geometry data from one spatial reference to another, use ST_Transform.

FunctionSyntax
Pythonsrid(geometry, srid=None)
SQLST_SRID(geometry, srid)
Scalasrid(geometry, srid)

For more details, go to the GeoAnalytics Engine API reference for srid.

This function implements the OpenGIS Simple Features Implementation Specification for SQL 1.2.1.

Examples

Setter

PythonPythonSQLScala
1
2
3
4
5
6
7
8
9

from geoanalytics.sql import functions as ST, Point

df = spark.createDataFrame([(Point(-178, -17),)], ["point"])

df.withColumn("srid", ST.srid("point")).show()

df.select(ST.srid("point", 4326).alias("point"))\
  .withColumn("srid", ST.srid("point")).show()
Result-as-setter
1
2
3
4
5
6
7
8
9
10
11
+------------------+----+
|             point|srid|
+------------------+----+
|{"x":-178,"y":-17}|   0|
+------------------+----+

+------------------+----+
|             point|srid|
+------------------+----+
|{"x":-178,"y":-17}|4326|
+------------------+----+

Getter

PythonPythonSQLScala
1
2
3
4
5
6
7

from geoanalytics.sql import functions as ST

df = spark.createDataFrame([("POINT (-2533858.73 8107527.81)",)], ["wkt"])\
          .select(ST.point_from_text("wkt", srid=54008).alias("geometry"))

df.select(ST.srid("geometry").alias("srid")).show()
Result-as-getter
1
2
3
4
5
+-----+
| srid|
+-----+
|54008|
+-----+

Version table

ReleaseNotes

1.0.0

Python and SQL functions introduced

1.5.0

Scala function introduced

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.

You can no longer sign into this site. Go to your ArcGIS portal or the ArcGIS Location Platform dashboard to perform management tasks.

Your ArcGIS portal

Create, manage, and access API keys and OAuth 2.0 developer credentials, hosted layers, and data services.

Your ArcGIS Location Platform dashboard

Manage billing, monitor service usage, and access additional resources.

Learn more about these changes in the What's new in Esri Developers June 2024 blog post.

Close