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.
Function | Syntax |
---|---|
Python | y(point, new |
SQL | ST |
Scala | y(point, value) |
For more details, go to the GeoAnalytics for Microsoft Fabric API reference for y.
This function implements the OpenGIS Simple Features Implementation Specification for SQL 1.2.1.
Examples
Getter
from geoanalytics_fabric.sql import functions as ST, Point
df = spark.createDataFrame([(Point(-178, -17),)], ["point"])
df.select(ST.y("point").alias("get_y")).show()
+-----+
|get_y|
+-----+
|-17.0|
+-----+
Setter
from geoanalytics_fabric.sql import functions as ST, Point
df = spark.createDataFrame([(Point(-178, -17),)], ["point"])
df.select(ST.y("point",2).alias("set_y")).show()
+----------------+
| set_y|
+----------------+
|{"x":-178,"y":2}|
+----------------+
Version table
Release | Notes |
---|---|
1.0.0-beta | Python, SQL, and Scala functions introduced |