ST_LineFromEsriJson takes a string column and returns a linestring column. The input string column must contain the
Esri JSON 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. Any SRID defined in the input Esri JSON strings will not be used.
If a linestring cannot be created from the input string the function will return null
.
Function | Syntax |
---|---|
Python | line |
SQL | ST |
Scal | line |
For more details, go to the GeoAnalytics for Microsoft Fabric API reference for line_from_esri_json.
Examples
from geoanalytics_fabric.sql import functions as ST
line_esri_json = '{"paths": [[[-7489594.84, 5178779.67],[-7474281.07,5176558.51],[-7465977.43,5179778.83]]]}'
df = spark.createDataFrame([(line_esri_json,)],["esri_json"])
df.select(ST.line_from_esri_json("esri_json", sr=8857).alias("line_from_esri_json")).show(truncate=False)
+----------------------------------------------------------------------------------------+
|line_from_esri_json |
+----------------------------------------------------------------------------------------+
|{"paths":[[[-7489594.84,5178779.67],[-7474281.07,5176558.51],[-7465977.43,5179778.83]]]}|
+----------------------------------------------------------------------------------------+
Version table
Release | Notes |
---|---|
1.0.0-beta | Python, SQL, and Scala functions introduced |