ST_PointFromGeoJSON

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.

FunctionSyntax
Pythonpoint_from_geojson(json_str,sr=None)
SQLST_PointFromGeoJson(json_str,sr)
ScalapointFromGeojson(json,sr)

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

Examples

PythonPythonSQLScala
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
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
Use dark colors for code blocksCopy
1
2
3
4
5
+----------------------+
|point_from_geojson    |
+----------------------+
|{"x":-80.87,"y":35.21}|
+----------------------+

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.