ST_M

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

Getter: ST_M takes a point column and returns a double column containing the m-values of the input points. If a point does not have an m-value the function returns NaN.

Setter: ST_M takes a point column and a numeric value and returns a point column containing the input points with the m-values set to the numeric value.

FunctionSyntax
Pythonm(point, new_value=None)
SQLST_M(point, new_value)
Scalam(point, value)

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

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
8
9
10
11
12
13
from geoanalytics_fabric.sql import functions as ST

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

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

df.select(ST.m("point").alias("get_m")).show()
Result-as-getter
Use dark colors for code blocksCopy
1
2
3
4
5
6
+------+
| get_m|
+------+
|187.73|
|   NaN|
+------+

Setter

PythonPythonSQLScala
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
from geoanalytics_fabric.sql import functions as ST

data = [
    ('{"x": -0.126,"y": 51.504,"m": 187.73}', 43.26),
    ('{"x": -0.126,"y": 51.504}', 97.22)
]

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

df.select(ST.m("point", "new_value").alias("set_m")).show(truncate=False)
Result-as-setter
Use dark colors for code blocksCopy
1
2
3
4
5
6
+---------------------------------+
|set_m                            |
+---------------------------------+
|{"x":-0.126,"y":51.504,"m":43.26}|
|{"x":-0.126,"y":51.504,"m":97.22}|
+---------------------------------+

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.