Bug #100502 spatial-geojson-functions
Submitted: 12 Aug 2020 8:46 Modified: 14 Aug 2020 14:11
Reporter: Taras Taras Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S2 (Serious)
Version:8.0 OS:Microsoft Windows
Assigned to: CPU Architecture:Any
Tags: spatial, st_geomfromgeojson

[12 Aug 2020 8:46] Taras Taras
Description:
When I running last example from doc page https://dev.mysql.com/doc/refman/8.0/en/spatial-geojson-functions.html
I receive invalid WKT axis-order. In docs I should receive that "POINT(102 0)" in fact I receive that "POINT(0 102)"

How to repeat:
RUN 
SET @json = '{ "type": "Point", "coordinates": [102.0, 0.0]}';
SELECT ST_AsText(ST_GeomFromGeoJSON(@json));
[12 Aug 2020 9:20] MySQL Verification Team
Thank you for the bug report.
[14 Aug 2020 14:11] Paul Dubois
Posted by developer:
 
Revised example:

This example shows the parsing result for a simple GeoJSON object.
Observe that the order of coordinates depends on the SRID used.

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)                                    |
+-------------------------------------------------+