I've carefully cut the collar off a set of USGS geotifs and I'd like to run through them with gdal2tiles but producing a vrt that undersands the alpha layer, or having gdal2tiles overlap two source files into one tile is not working. Some things I have tried have made all black pixels transparent. Other attempts rendered the transparent borders on my source files as if they were solid white, so when one tile is made from two adjoining tifs the transparent border from one covers up the useful content of another. Here is my process, maybe someone can tell me a conversion step I'm missing:
- Download regular USGS geotif from Topoquest
- gdal_translate -expand rgba -co COMPRESS=LZW orginal.tif translated.tif
- Open translated.tif in Photoshop, cut off the collar, save.
- gdalcopyproj.py translated.tif prepared.tif
Do that for all of them
- gdalbuildvrt temp.vrt *.tif
- gdal2tiles.py temp.vrt tiles
P.S. I can merge them all smoothly with gdal_warp but on this group of 30 it is making a combined geotiff of 51223 x 65163 and on other sets there will be lots of wasted space when the source tifs are in a diagonal line but gdal_warp will create a rectangular output.
gdalbuildvrt -srcnodata b4 -hidenodata map.vrt *.tif
. See MerseyViking's answer for how I got there