ST_MPointFromGeoJSON takes a string column and returns a multipoint column. The input string column must contain the
GeoJSON representation of multipoint geometries.
You can optionally specify a spatial reference for the result multipoint column.
The sr
parameter value must be a valid SRID or WKT string.
If a multipoint cannot be created from the input string the function will return null
.
Function | Syntax |
---|---|
Python | mpoint |
SQL | ST |
Scala | m |
For more details, go to the GeoAnalytics for Microsoft Fabric API reference for mpoint_from_geojson.
Examples
from geoanalytics_fabric.sql import functions as ST
mpoint_geojson = '{"type":"MultiPoint","coordinates":[[-3159938.72,8190159.75],[-3046133.91,8190159.75],[-3188072.29,8103229.92]],"crs":null}'
df = spark.createDataFrame([(mpoint_geojson, )], ["geojson"])
df.select(ST.mpoint_from_geojson("geojson", sr=54008).alias("mpoint_from_geojson")).show(truncate=False)
Result
+---------------------------------------------------------------------------------------+
|mpoint_from_geojson |
+---------------------------------------------------------------------------------------+
|{"points":[[-3159938.72,8190159.75],[-3046133.91,8190159.75],[-3188072.29,8103229.92]]}|
+---------------------------------------------------------------------------------------+
Version table
Release | Notes |
---|---|
1.0.0-beta | Python, SQL, and Scala functions introduced |