ST_GeomFromGeoJSON was added in MariaDB 10.2.4
ST_GeomFromGeoJSON(g[, option])
Given a GeoJSON input g, returns a geometry object. The option specifies what to do if g contains geometries with coordinate dimensions higher than 2.
Option | Description |
---|---|
1 | Return an error (the default) |
2 - 4 | The document is accepted, but the coordinates for higher coordinate dimensions are stripped off. |
Note that this function did not work correctly before MariaDB 10.2.8 - see MDEV-12180.
SET @j = '{ "type": "Point", "coordinates": [5.3, 15.0]}'; SELECT ST_AsText(ST_GeomFromGeoJSON(@j)); +-----------------------------------+ | ST_AsText(ST_GeomFromGeoJSON(@j)) | +-----------------------------------+ | POINT(5.3 15) | +-----------------------------------+
© 2019 MariaDB
Licensed under the Creative Commons Attribution 3.0 Unported License and the GNU Free Documentation License.
https://mariadb.com/kb/en/st_geomfromgeojson/