Seamless Horizons: Replacing SRTM Ocean NoData with 0m Sea Level
Shuttle Radar Topography Mission (SRTM) data is the gold standard for global elevation, but it contains a specific structural quirk: water bodies, particularly oceans, are often flagged as NoData (null) rather than 0 meters. While this correctly identifies the absence of radar return from water, it creates significant issues for hydrological modeling, 3D rendering, and spatial analysis where a continuous surface is required. In this tutorial, we will walk through the professional workflow to "fill" these voids with a constant 0m value while strictly maintaining the original 1-arcsecond (or 3-arcsecond) resolution and the WGS84 (EPSG:4326) geographic coordinate system.
Table of Content
- Purpose: Establishing a Global Base Level
- Initial Data Verification
- Step-by-Step: QGIS Raster Calculator
- Step-by-Step: GDAL Command Line (Fastest)
- Use Case: Coastal Inundation Mapping
- Best Results: Compression and Data Types
- FAQ
- Disclaimer
Purpose
Replacing NoData with a zero-value sea surface is essential for:
- Hydraulic Connectivity: Ensuring that coastal drainage basins "empty" into a defined 0m surface rather than a computational void.
- Consistent Extent: Maintaining a rectangular bounding box where "empty" pixels still carry a numeric value for matrix-based processing.
- Symbology Logic: Allowing for a clean color ramp that transitions from 0m (Blue/Sea) to positive integers (Land).
Initial Data Verification
Before processing, you must identify what your specific SRTM file uses as a NoData value.
- Right-click the layer in QGIS > Properties > Information.
- Look for No Data Value. Common SRTM values are
-32768or-9999.
Step-by-Step: QGIS Raster Calculator
The QGIS Raster Calculator allows us to use conditional logic to swap null values for zeros. Note that the native QGIS calculator sometimes struggles with "NoData" recognition, so we use a boolean expression.
1. Open the Calculator
Navigate to Raster > Raster Calculator...
2. Enter the Expression
Assuming your layer is named SRTM_Data@1, use the following logic to check if data exists; if it doesn't, add 0.
("SRTM_Data@1" != -32768) "SRTM_Data@1"
How it works: If the pixel is NOT -32768, it returns 1 (True) and multiplies by the original value. If it IS -32768, it returns 0 (False), resulting in a 0 value for that pixel.
3. Set Output Parameters
- Output CRS: EPSG:4326.
- Extent: Click "Calculate from Layer" to match your source.
Step-by-Step: GDAL Command Line (Fastest)
For large datasets or multiple tiles, the GDAL_calc utility is significantly more efficient and handles NoData mapping explicitly.
gdal_calc.py -A srtm_input.tif --outfile=srtm_fixed.tif --calc="A(A!=-32768)" --NoDataValue=none --type='Int16'
Alternatively, if you want to use the Translate tool to simply "unset" the NoData flag and treat it as a literal value (which becomes 0 in many viewers):
gdal_translate -a_nodata none srtm_input.tif srtm_fixed.tif
Use Case: Coastal Inundation Mapping
When modeling sea-level rise in a coastal city like Jakarta or Miami, a NoData ocean acts as a "wall" in many simulation engines. By converting these pixels to 0m, the model can simulate water moving from the 0m baseline into low-lying land areas (e.g., 0.5m or 1m elevation) during a storm surge. Without this fix, the model might fail to initialize or produce "Null" errors at the shoreline.
Best Results
| Factor | Recommendation | Why? |
|---|---|---|
| Data Type | Int16 (Short Integer) | SRTM is naturally Int16; using Float32 doubles the file size needlessly. |
| Compression | LZW or DEFLATE | Huge ocean areas of "0" compress extremely well (up to 90% reduction). |
| Resampling | None (Original) | Keep "Nearest Neighbor" to ensure you don't blur the coastline. |
FAQ
Why didn't 'Fill NoData' work?
The GDAL FillNoData tool uses an interpolation algorithm (like Inverse Distance Weighting) to guess values based on neighbors. This is great for small holes (pits), but for the ocean, it will try to "slope" the land into the sea, which is geographically incorrect for a 0m surface.
Does this change my land elevations?
No. By using the boolean multiplication (A != NoData) A, every pixel that already has a valid elevation (like 500m) is multiplied by 1, preserving its exact value.
What if my NoData is already 0 but still shows as a hole?
This means the metadata tag "NoData = 0" is present. Use gdal_edit.py -unsetnodata to remove that tag, making the 0s act like regular elevation data.
Disclaimer
Converting NoData to 0m assumes all NoData areas are at sea level. In some mountainous SRTM tiles, NoData can represent "radar shadows" or steep cliffs where the sensor failed. Always cross-reference with a secondary source (like ASTER or ALOS) if working in high-relief inland terrain. March 2026.
Tags: SRTM_Fix, NoData_to_Zero, Raster_Calculator, GIS_Elevation