Data Scenario: Raster missing NoData value
File Name | Modified |
---|---|
bambgrl_dem_5km_corrected.tif | 8/2/23, 8:53:13 PM |
solution-gdal_translate.sh | 8/2/23, 8:53:13 PM |
You download the dataset bambgrl_dem_5km_corrected.tif
(Bamber 2001) and open it in QGIS. You observe that ocean values all appear black. You use the Identify tool to verify all the black values are the same: 1.1
.
At this point, you are not sure what this represents, so you consult the user guide to find this important phrase at the top of page 4:
DEM values of -0.1 m represent ocean
Since you don’t need this dataset to represent ocean locations (and it covers up your basemap), you decide you would like to encode this ocean value in the metadata as a NoData value.
Validation
The dataset should not show ocean values when initially opened in QGIS.
This problem can be solved with symbology, but that is not what we are aiming for here. We want a file with the ocean pixels encoded internally as NoData values so we can share it with others and they will not have to deal with this issue.
The floating point nodata
value used for this dataset illustrates how floating point values can be problematic for encoding flag values. Some tools will identify the nodata cells as -0.1
, a truncated representation, and others will identify the value as -0.10000000149011612
. Consider NaN
instead!