[gdal-dev] gdal_retile.py does not use a nodata value from GeoTIFF

Marco Nijdam marco at west.nl
Fri Jan 24 02:07:58 PST 2014

Dear gdal developers,

I've used gdal_retile.py to retile a set of GeoTIFF files, with 1
grayscale band of type float32. In these files a NoData value is stored. I
used retile to reduce the number of GeoTIFF files from 1300 or so smaller
files to 40 or so larger files. When I use gdalinfo on the original files,
a relevant part of the output is:

Band 1 Block=1000x2 Type=Float32, ColorInterp=Gray
  Min=-0.848 Max=18.454
  Minimum=-0.848, Maximum=18.454, Mean=4.426, StdDev=3.674
  NoData Value=-3.4028234663852886e+38

When using gdal_retile.py, it seems that for all areas where there is no
data in the input files (mainly where there is no input file at all for an
area), the resulting retiled files contain a value of 0. It doesn't seem
to be using the NoData value from the input, and doesn't seems to allow
specifying a specific NoData value (like gdal_translate which has a
-a_nodata parameter). It also doesn't store the NoData tag in the created
retiled GeoTIFFs.

The problem for us is that a value of 0 represents a valid value (it is a

Due to our environment I needed to work with GDAL 1.7.2. For this version
I created a patch for gdal_retile.py that fills the tile with the NoData
value before putting the data over it. It also sets the NoData tag in the
I've only tested it with our own dataset, so I don't know how it will
behave with any other, or non-tiff files.

Please feel free to use it in any future version, if you think it is a
useful addition.

Attached are the patch, and the modified 1.7.2 gdal_retile.py.

Kind regards,
-- Marco Nijdam,         marco at west.nl
-- West Consulting B.V., Delftechpark 5, 2628 XJ  Delft, The Netherlands
-- Tel: +3115 219 1600,  Fax: +3115 214 7889, Mob: +316 2040 7591

-------------- next part --------------
A non-text attachment was scrubbed...
Name: gdal_retile.py.patch
Type: application/octet-stream
Size: 1847 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20140124/dfab3074/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gdal_retile.py
Type: application/octet-stream
Size: 29422 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20140124/dfab3074/attachment-0003.obj>

More information about the gdal-dev mailing list