I have several hundered geotiff files. Some of them (almost all of them) have black areas (irregular) on the edges. However, these black areas are covered by some other file in the file set.

I read this post but it looks that the black in my file is not marked as NODATA (only 3 bands in the VRT file).

Is there away to join/overlap two geotiff files (into one) and make the black color as transparent so missing areas are filled from the other file?


1 Answer 1


You can use gdal_translate with -a_nodata value to assign NODATA to a certain pixel value. See also http://www.gdal.org/gdal_translate.html . After that you can merge them with gdalwarp.

  • Caution: This would also incorrectly assign NODATA to any black pixels within the image area (assuming the specified value for gdal_translate -a_nodata is black). In other words, pixels that are legitimately supposed to be black would be NODATA.
    – user3461
    Jan 5, 2012 at 20:26
  • I did the first step. The second takes alot of time. It is already 2 days running and still not finished. is this ok for gdalwarp? (7 files, 2.7G each)
    – alsaleem
    Jan 7, 2012 at 6:49
  • 1
    You can greatly speed up things using the GDAL cache: gdalwarp --config GDAL_CACHEMAX 3000 -wm 3000 ...
    – markusN
    Mar 3, 2012 at 5:29

This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .