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

ST_AsGeoJSON argument does not limit decimals

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

          greenman Ian Gilfillan created issue -
          serg Sergei Golubchik made changes -
          Field Original Value New Value
          Assignee Alexey Botchkov [ holyfoot ]
          serg Sergei Golubchik made changes -
          Fix Version/s 10.2 [ 14601 ]
          greenman Ian Gilfillan added a comment -

          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.

          greenman Ian Gilfillan added a comment - 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.
          holyfoot Alexey Botchkov made changes -
          Status Open [ 1 ] In Progress [ 3 ]

          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.

          holyfoot Alexey Botchkov added a comment - 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.
          holyfoot Alexey Botchkov added a comment - http://lists.askmonty.org/pipermail/commits/2017-August/011353.html
          holyfoot Alexey Botchkov made changes -
          issue.field.resolutiondate 2017-08-07 09:14:21.0 2017-08-07 09:14:21.936
          holyfoot Alexey Botchkov made changes -
          Component/s GIS [ 10105 ]
          Fix Version/s 10.2.7 [ 22543 ]
          Fix Version/s 10.2 [ 14601 ]
          Resolution Fixed [ 1 ]
          Status In Progress [ 3 ] Closed [ 6 ]
          greenman Ian Gilfillan made changes -
          Fix Version/s 10.2.8 [ 22544 ]
          Fix Version/s 10.2.7 [ 22543 ]
          serg Sergei Golubchik made changes -
          Workflow MariaDB v3 [ 79845 ] MariaDB v4 [ 151773 ]

          People

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

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.