ST_LineFromGeoJSON

ST_LineFromGeoJSON takes a string column and returns a linestring column. The input string column must contain the GeoJSON representation of linestring geometries. You can optionally specify a spatial reference for the result linestring column. The sr parameter value must be a valid SRID or WKT string. If a linestring cannot be created from the input string the function will return null.

FunctionSyntax
Pythonline_from_geojson(json_str,sr=None)
SQLST_LineFromGeoJson(json_str,sr)
ScalalineFromGeoJson(json,sr)

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

Examples

PythonPythonSQLScala
1
2
3
4
5
6
7
8

from geoanalytics_fabric.sql import functions as ST

line_geojson = '{"type": "LineString","coordinates": [[-7489594.84,5178779.67],[-7474281.07,5176558.51],[-7465977.43,5179778.83]]}'

df = spark.createDataFrame([(line_geojson,)],["geojson"])

df.select(ST.line_from_geojson("geojson", sr=8857).alias("line_from_geojson")).show(truncate=False)
Result
1
2
3
4
5
+----------------------------------------------------------------------------------------+
|line_from_geojson                                                                       |
+----------------------------------------------------------------------------------------+
|{"paths":[[[-7489594.84,5178779.67],[-7474281.07,5176558.51],[-7465977.43,5179778.83]]]}|
+----------------------------------------------------------------------------------------+

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