ST_PointFromGeoJSON takes a string column and returns a point column. The input string column must contain the
GeoJSON representation of point geometries.
You can optionally specify a spatial reference for the result point column.
The sr parameter value must be a valid SRID or WKT string.
If a point cannot be created from the input string the function will return null.
| Function | Syntax |
|---|---|
| Python | point |
| SQL | ST |
| Scala | point |
For more details, go to the GeoAnalytics for Microsoft Fabric API reference for point_from_geojson.
Examples
from geoanalytics_fabric.sql import functions as ST
point_geojson = '{"type":"Point","coordinates":[-80.87, 35.21],"crs":null}'
df = spark.createDataFrame([(point_geojson, )], ["geojson"])
df.select(ST.point_from_geojson("geojson", sr=4326).alias("point_from_geojson")).show(truncate=False)Result
+----------------------+
|point_from_geojson |
+----------------------+
|{"x":-80.87,"y":35.21}|
+----------------------+Version table
| Release | Notes |
|---|---|
1.0.0-beta | Python, SQL, and Scala functions introduced |