Version 1 (modified by 9 years ago) ( diff ) | ,
---|
RFC 58: Removing Dataset Nodata Value
Authors: Sean Gillies
Contact: sean at mapbox.com
Status: Draft
Summary
This RFC adds a GDALDeleteNoDataValue() function to the GDAL C API. This function removes a dataset's nodata value. When it succeeds, the dataset will have no nodata value. When it fails, the nodata value will be unchanged.
Rationale
In the C API the nodata value has accessors GDALGetNoDataValue()
and GDALSetNoDataValue()
. For GeoTIFFs, the value is stored in a TIFFTAG_GDAL_NODATA TIFF tag. Newly created GeoTIFF files can have no nodata value (no tag), but once a nodata value is set and stored it can only be given new values, it can not be removed. Nor can it be set to a value outside the range of the data type; for 8-bit data passing nan
, -inf
, or 256
to GDALSetNoDataValue()
has the same effect as passing 0.
The problem with un-removable nodata values is this:
- Nodata masks (see GDAL RFC 15) can cover up a nodata value but if the .msk file gets lost (and this is ever the problem with sidecar files), the nodata value you were hiding is exposed again.
- Nodata masks are not available everywhere in GDAL, nodata values are the only definition of valid data in some parts of GDAL.
The current recommended practice for removing a nodata value is to copy the GeoTIFF using gdal_translate, specifying that the nodata tag not be copied over along with the data. By making the nodata value fully editable and removable we could avoid copying unnecessarily.
Changes
GDALDeleteNoDataValue()
will be added to gdal.h.
Updated drivers
The following drivers will be updated: GTiff, MEM, VRT.
The GDALPamRasterBand
class will also be updated (for drivers that have no built-in mechanism nodata mechanism and rely on .aux.xml sidecars).
SWIG bindings (Python / Java / C# / Perl) changes
No changes to the SWIG bindings are proposed.
Utilities
No changes to utilities are proposed.
Documentation
No new documentation is proposed.
Test Suite
TBD.
Compatibility Issues
None.
Implementation
Implementation will be done by Even Rouault and be sponsored by Mapbox.