ST_PolyFromEsriJSON takes a string column and returns a polygon column. The input string column must contain the
Esri JSON representation of
polygon geometries. You can optionally specify a spatial reference for the result polygon column.
The sr parameter value must be a valid SRID or WKT string.
Any SRID defined in the input strings will not be used.
If a polygon cannot be created from the input string the function will return null.
| Function | Syntax |
|---|---|
| Python | poly |
| SQL | ST |
| Scala | poly |
For more details, go to the GeoAnalytics for Microsoft Fabric API reference for poly_from_esri_json.
Examples
from geoanalytics_fabric.sql import functions as ST
poly_esri_json = '{"rings":[[[20,30],[18,28],[22,35],[20,30]]]}'
df = spark.createDataFrame([(poly_esri_json, )], ["esri_json"])
df.select(ST.poly_from_esri_json("esri_json", sr=4326).alias("poly_from_esri_json")).show(truncate=False)+---------------------------------------------+
|poly_from_esri_json |
+---------------------------------------------+
|{"rings":[[[20,30],[18,28],[22,35],[20,30]]]}|
+---------------------------------------------+Version table
| Release | Notes |
|---|---|
1.0.0-beta | Python, SQL, and Scala functions introduced |