ST_Z

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

Getter: ST_Z takes a point column and returns a double column containing the z-coordinates of the input points. If a point does not have a z-coordinate the function returns NaN.

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

FunctionSyntax
Pythonz(point, new_value=None)
SQLST_Z(point, new_value)
Scalaz(point, value)

For more details, go to the GeoAnalytics for Microsoft Fabric API reference for z.

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

Examples

Getter

PythonPythonSQLScala
1
2
3
4
5
6
7
8
9
10
11
12

from geoanalytics_fabric.sql import functions as ST

data = [
    ('{"x": -0.126,"y": 51.504,"z": 11253}',),
    ('{"x": -0.126,"y": 51.504}',)
]

df = spark.createDataFrame(data, ["esri_json"]) \
    .withColumn("point", ST.point_from_esri_json("esri_json"))

df.select(ST.z("point").alias("get_z")).show()
Result-as-getter
1
2
3
4
5
6
+-------+
|  get_z|
+-------+
|11253.0|
|    NaN|
+-------+

Setter

PythonPythonSQLScala
1
2
3
4
5
6
7
8
9
10
11
12

from geoanalytics_fabric.sql import functions as ST

data = [
    ('{"x": -0.126,"y": 51.504,"z": 11253}', 12000),
    ('{"x": -0.126,"y": 51.504}', 10000)
]

df = spark.createDataFrame(data, ["esri_json", "new_value"]) \
    .withColumn("point", ST.point_from_esri_json("esri_json"))

df.select(ST.z("point", "new_value").alias("set_z")).show(truncate=False)
Result-as-setter
1
2
3
4
5
6
+---------------------------------+
|set_z                            |
+---------------------------------+
|{"x":-0.126,"y":51.504,"z":12000}|
|{"x":-0.126,"y":51.504,"z":10000}|
+---------------------------------+

Version table

ReleaseNotes

1.0.0-beta

Python, SQL, and Scala functions 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