ST_PointFromEsriJSON

ST_PointFromEsriJSON takes a string column and returns a point column. The input string column must contain the Esri JSON 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. Any SRID defined in the input Esri JSON strings will not be used. If a point cannot be created from the input string the function will return null.

FunctionSyntax
Pythonpoint_from_esri_json(json_str,sr=None)
SQLST_PointFromEsriJson(json_str,sr)
ScalapointFromEsriJson(json,sr)

For more details, go to the GeoAnalytics Engine API reference for point_from_esri_json.

Examples

PythonPythonSQLScala
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
from geoanalytics.sql import functions as ST

df = spark.createDataFrame([('{"x":-178.0,"y":-17.0}', )], ["esri_json"])

df.select(ST.point_from_esri_json("esri_json", srid=4326).alias("point_from_esri_json")).show(truncate=False)
Result
Use dark colors for code blocksCopy
1
2
3
4
5
+--------------------+
|point_from_esri_json|
+--------------------+
|{"x":-178,"y":-17}  |
+--------------------+

Version table

ReleaseNotes

1.0.0

Python and SQL functions introduced

1.5.0

Scala function introduced

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.