ST_X

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

Getter: ST_X takes a point column and returns a double column containing the x-coordinate of the input points.

Setter: ST_X takes a point column and a numeric value or column and returns a point column containing the input points with the x-coordinates set to the numeric value.

FunctionSyntax
Pythonx(point, new_value=None)
SQLST_X(point, new_value)
Scalax(point, value)

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

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

Examples

Getter

PythonPythonSQLScala
1
2
3
4
5
6

from geoanalytics.sql import functions as ST, Point

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

df.select(ST.x("point").alias("get_x")).show()
Result-as-getter
1
2
3
4
5
+------+
| get_x|
+------+
|-178.0|
+------+

Setter

PythonPythonSQLScala
1
2
3
4
5
6

from geoanalytics.sql import functions as ST, Point

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

df.select(ST.x("point",-150).alias("set_x")).show()
Result-as-setter
1
2
3
4
5
+------------------+
|             set_x|
+------------------+
|{"x":-150,"y":-17}|
+------------------+

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