Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-12181

ST_AsGeoJSON argument does not limit decimals

    XMLWordPrintable

    Details

      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]}      |
      +-------------------------------------------------------+
      

        Attachments

          Activity

            People

            Assignee:
            holyfoot Alexey Botchkov
            Reporter:
            greenman Ian Gilfillan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: