st_geomfromgeojson function
Applies to: Databricks SQL
Databricks Runtime 17.1 and above
Lakehouse//RT
注記
This feature is not available on Databricks SQL Classic warehouses. To learn more about Databricks SQL warehouses, see SQL warehouse types.
Parses the GeoJSON description of a geometry and returns the corresponding GEOMETRY value.
The SRID value of the returned GEOMETRY value is 4326.
Syntax
st_geomfromgeojson ( geojsonExpr )
Arguments
geojsonExpr: ASTRINGvalue, representing a geography in GeoJSON format.
Returns
A value of type GEOMETRY(4326), corresponding to the input GeoJSON description.
The function returns NULL if the input is NULL.
Error conditions
- If the value of
geojsonExpris an invalid GeoJSON description, the function returns GEOJSON_PARSE_ERROR.
Examples
SQL
-- Simple example.
> SELECT st_asewkt(st_geomfromgeojson('{"type":"Point","coordinates":[10,34,23]}'));
SRID=4326;POINT Z (10 34 23)
Related functions
st_asbinaryfunctionst_asewkbfunctionst_asewktfunctionst_asgeojsonfunctionst_astextfunctionst_geogfromewktfunctionst_geogfromgeojsonfunctionst_geogfromtextfunctionst_geogfromwkbfunctionst_geomfromewkbfunctionst_geomfromewktfunctionst_geomfromtextfunctionst_geomfromwkbfunctionto_geographyfunctionto_geometryfunctiontry_to_geographyfunctiontry_to_geometryfunction