Bug report #17669

GeoJSON export includes z-dimension even if unticked

Added by Johannes Kroeger almost 3 years ago. Updated about 2 years ago.

Status:Closed
Priority:Normal
Assignee:Nyall Dawson
Category:Unknown
Affected QGIS version:2.18.14 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:25566

Description

Load the following GeoJSON

{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature", "properties": {},
      "geometry": { "type": "Polygon", "coordinates": [[
        [ 0, 0, 0 ],
        [ 1, 0, 0 ],
        [ 1, 1, 0 ],
        [ 0, 1, 0 ],
        [ 0, 0, 0 ]
        ]]
      }
    }
  ]
}

and inspect the metadata:

Geometry type of the features in this layer
Polygon (WKB type: "PolygonZ")

You see it has a z-dimension.

Now save the layer as new GeoJSON file, force the geometry type to Polygon and untick "Include z-dimension".

The new file will still include the z coordinates even though we told QGIS to not include it.

This does not happen when saving to Shapefile, I did not try others. The GeoJSON spec allows a third element in the coordinates array so the input seems to be valid.

Associated revisions

Revision 0f22a29b
Added by Nyall Dawson about 2 years ago

Fix dropping/adding z dimensions to certain output data types
where the layer geometry type is defined by features, not preset
in advance

Fixes #20220, #17669

History

#1 Updated by Jason Ferrier about 2 years ago

This issue is still happening with 3.2.3.

It it not limited to GeoJSON and also affects CSV, so I created a issue for that as well: #20220

#2 Updated by Nyall Dawson about 2 years ago

  • Assignee set to Nyall Dawson
  • Status changed from Open to In Progress

#3 Updated by Nyall Dawson about 2 years ago

  • % Done changed from 0 to 100
  • Status changed from In Progress to Closed

Also available in: Atom PDF