[MDEV-12181] ST_AsGeoJSON argument does not limit decimals Created: 2017-03-06  Updated: 2017-08-07  Resolved: 2017-08-07

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   

The MySQL 5.7 ST_AsGeoJSON function has an argument that limits the number of decimals:
https://dev.mysql.com/doc/refman/5.7/en/spatial-geojson-functions.html#function_st-asgeojson

MariaDB accepts an argument but it has no effect:

In MySQL 5.7:

mysql [localhost] {msandbox} ((none)) > SELECT ST_AsGeoJSON(ST_GeomFromText('POINT(5.333 7.222)'),2);
+-------------------------------------------------------+
| ST_AsGeoJSON(ST_GeomFromText('POINT(5.333 7.222)'),2) |
+-------------------------------------------------------+
| {"type": "Point", "coordinates": [5.33, 7.22]}        |
+-------------------------------------------------------+
1 row in set (0.00 sec)

In MariaDB:

SELECT ST_AsGeoJSON(ST_GeomFromText('POINT(5.333 7.222)'),2);
+-------------------------------------------------------+
| ST_AsGeoJSON(ST_GeomFromText('POINT(5.333 7.222)'),2) |
+-------------------------------------------------------+
| {"type": "Point", "coordinates": [5.333, 7.222]}      |
+-------------------------------------------------------+



 Comments   
Comment by Ian Gilfillan [ 2017-06-22 ]

Can you comment on whether this is supposed to behave like the MySQL version (max_digits and options)? I'd like to document what it should do, even if it's not working at present.

Comment by Alexey Botchkov [ 2017-08-07 ]

Ian,
after the fix the decimals are limited with the paramenter.
The 'options' are NOT completely like MySQL - only support the '1' option to add the boundary box.

Comment by Alexey Botchkov [ 2017-08-07 ]

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

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