Топ-100
 

ST_GEOMFROMGEOJSON

База данных: MySQL
Текст

ST_GeomFromGeoJSON(str [, options [, srid]])

Parses a string str representing a GeoJSON object and returns a
geometry.

If any argument is NULL, the return value is NULL. If any non-NULL
argument is invalid, an error occurs.

URL: https://dev.mysql.com/doc/refman/8.0/en/spatial-geojson-functions.html

Пример

mysql> SET @json = '{ "type": "Point", "coordinates": [102.0, 0.0]}';
mysql> SELECT ST_AsText(ST_GeomFromGeoJSON(@json));
+--------------------------------------+
| ST_AsText(ST_GeomFromGeoJSON(@json)) |
+--------------------------------------+
| POINT(0 102) |
+--------------------------------------+
mysql> SELECT ST_SRID(ST_GeomFromGeoJSON(@json));
+------------------------------------+
| ST_SRID(ST_GeomFromGeoJSON(@json)) |
+------------------------------------+
| 4326 |
+------------------------------------+
mysql> SELECT ST_AsText(ST_SRID(ST_GeomFromGeoJSON(@json),0));
+-------------------------------------------------+
| ST_AsText(ST_SRID(ST_GeomFromGeoJSON(@json),0)) |
+-------------------------------------------------+
| POINT(102 0) |
+-------------------------------------------------+