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

Support for GeometryCollection in GeoJSON

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Cannot Reproduce
    • 10.2(EOL)
    • 10.2.11
    • JSON
    • None
    • 10.2.11

    Description

      GeometryCollection is valid Geometry object:

      MariaDB [(none)]> select st_astext(st_GeomFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))'));
      +-------------------------------------------------------------------------------------+
      | st_astext(st_GeomFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')) |
      +-------------------------------------------------------------------------------------+
      | GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10))                                |
      +-------------------------------------------------------------------------------------+
      

      GeoJson should handle it , e.g. with query:

      SELECT length(st_astext(st_geomfromgeojson('
      {
          "type": "GeometryCollection",
          "geometries": [
              {
                  "type": "Point",
                  "coordinates": [0,0]
              },
              {
                  "type": "LineString",
                  "coordinates": [[0,0],[10,10]]
              }
          ]
      }'))) as a;
      

      MariaDB [(none)]> SELECT length(st_astext(st_geomfromgeojson('
          '> {
          '>     "type": "GeometryCollection",
          '>     "geometries": [
          '>         {
          '>             "type": "Point",
          '>             "coordinates": [0,0]
          '>         },
          '>         {
          '>             "type": "LineString",
          '>             "coordinates": [[0,0],[10,10]]
          '>         }
          '>     ]
          '> }'))) as a;
      +------+
      | a    |
      +------+
      | NULL |
      +------+
      

      MySQL 5.7 handles it properly

      mysql> SELECT length(st_astext(st_geomfromgeojson('
          '> {
          '>     "type": "GeometryCollection",
          '>     "geometries": [
          '>         {
          '>             "type": "Point",
          '>             "coordinates": [0,0]
          '>         },
          '>         {
          '>             "type": "LineString",
          '>             "coordinates": [[0,0],[10,10]]
          '>         }
          '>     ]
          '> }'))) as a;
      +------+
      | a    |
      +------+
      |   52 |
      +------+
      

      Attachments

        Activity

          People

            holyfoot Alexey Botchkov
            anikitin Andrii Nikitin (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 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.