ST_Y

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

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

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

FunctionSyntax
Pythony(point, new_value=None)
SQLST_Y(point, new_value)
Scalay(point, value)

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

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

Examples

Getter

PythonPythonSQLScala
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
from geoanalytics.sql import functions as ST, Point

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

df.select(ST.y("point").alias("get_y")).show()
Result-as-getter
Use dark colors for code blocksCopy
1
2
3
4
5
+-----+
|get_y|
+-----+
|-17.0|
+-----+

Setter

PythonPythonSQLScala
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
from geoanalytics.sql import functions as ST, Point

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

df.select(ST.y("point",2).alias("set_y")).show()
Result-as-setter
Use dark colors for code blocksCopy
1
2
3
4
5
+----------------+
|           set_y|
+----------------+
|{"x":-178,"y":2}|
+----------------+

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.