| 1 | = RFC 58: Removing Dataset Nodata Value = |
| 2 | |
| 3 | Authors: Sean Gillies |
| 4 | |
| 5 | Contact: sean at mapbox.com |
| 6 | |
| 7 | Status: Draft |
| 8 | |
| 9 | == Summary == |
| 10 | |
| 11 | 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. |
| 12 | |
| 13 | == Rationale == |
| 14 | |
| 15 | 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. |
| 16 | |
| 17 | The problem with un-removable nodata values is this: |
| 18 | |
| 19 | * 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. |
| 20 | * Nodata masks are not available everywhere in GDAL, nodata values are the only definition of valid data in some parts of GDAL. |
| 21 | |
| 22 | 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. |
| 23 | |
| 24 | == Changes == |
| 25 | |
| 26 | {{{GDALDeleteNoDataValue()}}} will be added to gdal.h. |
| 27 | |
| 28 | === Updated drivers === |
| 29 | |
| 30 | The following drivers will be updated: GTiff, MEM, VRT. |
| 31 | |
| 32 | The {{{GDALPamRasterBand}}} class will also be updated (for drivers that have no built-in mechanism nodata mechanism and rely on .aux.xml sidecars). |
| 33 | |
| 34 | == SWIG bindings (Python / Java / C# / Perl) changes == |
| 35 | |
| 36 | No changes to the SWIG bindings are proposed. |
| 37 | |
| 38 | == Utilities == |
| 39 | |
| 40 | No changes to utilities are proposed. |
| 41 | |
| 42 | == Documentation == |
| 43 | |
| 44 | No new documentation is proposed. |
| 45 | |
| 46 | == Test Suite == |
| 47 | |
| 48 | TBD. |
| 49 | |
| 50 | == Compatibility Issues == |
| 51 | |
| 52 | None. |
| 53 | |
| 54 | == Implementation == |
| 55 | |
| 56 | Implementation will be done by Even Rouault and be sponsored by Mapbox. |
| 57 | |
| 58 | == Voting history |