Bug report #16812
Saving GeoJson deletes NULL attributes if QGIS is compiled against GDAL 2.2
Status: | Closed | ||
---|---|---|---|
Priority: | High | ||
Assignee: | Even Rouault | ||
Category: | Data Provider/OGR | ||
Affected QGIS version: | 2.18.10 | Regression?: | Yes |
Operating System: | Easy fix?: | No | |
Pull Request or Patch supplied: | No | Resolution: | fixed/implemented |
Crashes QGIS or corrupts data: | No | Copied to github as #: | 24711 |
Description
As described in https://github.com/UCDavisLibrary/ava/issues/270, Saving Geojson removes any attributes that have null values.
This is a new behavior due to a change in GDAL 2.2 https://trac.osgeo.org/gdal/wiki/rfc67_nullfieldvalues which changes how null fields are handled.
Discussing with Even R. in IRC, it seems safer to '<EvenR> "unset as null" could be the default behaviour in QGIS. It should bring back the pre GDAL 2.2 behaviour'
That way any saves made while editing a layer won't remove attributes.
As an option the Save As dialog could allow users to override this behavior, dropping null fields to create a more compact geojson file.
Associated revisions
[OGR] Use OGR_F_SetFieldNull() with GDAL >= 2.2 to avoid GeoJSON fields to be unset (fixes #16812)
[OGR] Use OGR_F_SetFieldNull() with GDAL >= 2.2 to avoid GeoJSON fields to be unset (fixes #16812)
[OGR] Use OGR_F_SetFieldNull() with GDAL >= 2.2 to avoid GeoJSON fields to be unset (fixes #16812)
History
#1 Updated by Giovanni Manghi over 7 years ago
- Easy fix? changed from Yes to No
- Operating System deleted (
All) - Priority changed from Normal to High
- Subject changed from Saving GeoJson deletes null attributes to Saving GeoJson deletes NULL attributes if QGIS is compiled against GDAL 2.2
I'm reluctant to tag this as "regression" because technically is not a QGIS issue, point is that QGIS users that will start to hit this change will immediately point to QGIS as the culprit. If setting "unset as null" is trivial I suggest to implement it as soon as possible.
#2 Updated by Even Rouault over 7 years ago
- % Done changed from 0 to 100
- Status changed from Open to Closed
Applied in changeset qgis|7d67b02ae461adf5bbf8cc753ea61a64ec125bbc.
#3 Updated by Even Rouault over 7 years ago
- Resolution set to fixed/implemented