Background info: I've been generating some raster DTMs from vector points using gdal_rasterize, and was wondering if there is any consensus as to what is the best NoData value to use. The Python GDAL script I'm using appears to default to 0, but obviously that might be problematic if my country-wide dataset has areas close to sea level.
Sample of script I'm using:
try: from osgeo import ogr, osr, gdal
except: sys.exit('ERROR: cannot find GDAL/OGR modules')
nztmSRS = osr.SpatialReference()
nztmSRS.ImportFromEPSG(2193)
xRes, yRes =(5,5) #Spatial resolution defaults to 5 (metres)
src = "Points.shp"
dst = "Output.tif"
gdal.Rasterize(dst, src, outputSRS=nztmSRS.ExportToWkt(), xRes=xRes, yRes=yRes, noData="0",attribute='ELEVATION')
I've seen NoData values out there choosing -9999, -3.4028230607371e+38, etc. There are probably valid arguments for using any of those, and I'd like to have a feel of A) what the NoData options are and B) what seems to work better in different use cases. E.g. when:
- The output will need to be reprojected using gdalwarp
- The outputs will need to be mosaicked together with other geotifs
- The output will need to be loaded into Spatialite/Postgis down the line