[MDEV-12180] ST_GeomFromGeoJSON option argument appears to have no effect Created: 2017-03-06  Updated: 2017-08-07  Resolved: 2017-08-06

Status: Closed
Project: MariaDB Server
Component/s: GIS
Affects Version/s: 10.2.4
Fix Version/s: 10.2.8

Type: Bug Priority: Major
Reporter: Ian Gilfillan Assignee: Alexey Botchkov
Resolution: Fixed Votes: 0
Labels: gis, json-10.2


 Description   

In MySQL 5.7, ST_GeomFromGeoJSON has an option argument (1-4):
https://dev.mysql.com/doc/refman/5.7/en/spatial-geojson-functions.html#function_st-geomfromgeojson

SET @j = '{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}';
Query OK, 0 rows affected (0.00 sec)
 
mysql [localhost] {msandbox} ((none)) > SELECT ST_AsText(ST_GeomFromGeoJSON(@j,5));
ERROR 1411 (HY000): Incorrect option value: '5' for function st_geomfromgeojson
 
mysql [localhost] {msandbox} ((none)) > SELECT ST_AsText(ST_GeomFromGeoJSON(@j,4));
+-------------------------------------+
| ST_AsText(ST_GeomFromGeoJSON(@j,4)) |
+-------------------------------------+
| POINT(5.3 15)                       |
+-------------------------------------+
1 row in set (0.01 sec)
 
mysql [localhost] {msandbox} ((none)) > SELECT ST_AsText(ST_GeomFromGeoJSON(@j,1));
ERROR 3073 (HY000): Unsupported number of coordinate dimensions in function st_geomfromgeojson: Found 3, expected 2

In MariaDB, the option argument is accepted but appears to make no difference to anything. Is it intended that MariaDB match MySQL's behaviour? If so, this is a bug, if not, it needs to be documented what the argument does.

SET @j = '{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}';
Query OK, 0 rows affected (0.00 sec)
 
mysql [localhost] {msandbox} ((none)) > SELECT ST_AsText(ST_GeomFromGeoJSON(@j,2));
+-------------------------------------+
| ST_AsText(ST_GeomFromGeoJSON(@j,2)) |
+-------------------------------------+
| POINT(5.3 15)                       |
+-------------------------------------+
1 row in set (0.00 sec)
 
mysql [localhost] {msandbox} ((none)) > SELECT ST_AsText(ST_GeomFromGeoJSON(@j,1));
+-------------------------------------+
| ST_AsText(ST_GeomFromGeoJSON(@j,1)) |
+-------------------------------------+
| POINT(5.3 15)                       |
+-------------------------------------+
1 row in set (0.00 sec)
 
mysql [localhost] {msandbox} ((none)) > SELECT ST_AsText(ST_GeomFromGeoJSON(@j,3));
+-------------------------------------+
| ST_AsText(ST_GeomFromGeoJSON(@j,3)) |
+-------------------------------------+
| POINT(5.3 15)                       |
+-------------------------------------+
1 row in set (0.00 sec)
 
mysql [localhost] {msandbox} ((none)) > SELECT ST_AsText(ST_GeomFromGeoJSON(@j,4));
+-------------------------------------+
| ST_AsText(ST_GeomFromGeoJSON(@j,4)) |
+-------------------------------------+
| POINT(5.3 15)                       |
+-------------------------------------+
1 row in set (0.00 sec)
 
mysql [localhost] {msandbox} ((none)) > SELECT ST_AsText(ST_GeomFromGeoJSON(@j,5));
+-------------------------------------+
| ST_AsText(ST_GeomFromGeoJSON(@j,5)) |
+-------------------------------------+
| POINT(5.3 15)                       |
+-------------------------------------+
1 row in set (0.00 sec)
 
mysql [localhost] {msandbox} ((none)) > SELECT ST_AsText(ST_GeomFromGeoJSON(@j,6));
+-------------------------------------+
| ST_AsText(ST_GeomFromGeoJSON(@j,6)) |
+-------------------------------------+
| POINT(5.3 15)                       |
+-------------------------------------+
1 row in set (0.00 sec)



 Comments   
Comment by Alexey Botchkov [ 2017-08-06 ]

http://lists.askmonty.org/pipermail/commits/2017-August/011343.html

Comment by Ian Gilfillan [ 2017-08-07 ]

This needs to be documented, are the options the same as for MySQL?

Generated at Thu Feb 08 07:55:44 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.