<div dir="ltr">Hey John,<div><br></div><div>Is your TIF transparent background using properly the NODATA special value?</div><div>If so you can tell gdal2tiles how to interpret and translate the nodata in RGBA using the -a option</div><div><br></div><div>gdal2tiles.py SOURCE DEST -a 0,0,0,0</div><div><br></div><div>I think that should produce the desired effect</div><div><br></div><div>Let me know</div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><font color="#999999"><br></font></div><div><font color="#999999">---</font></div><div><font color="#999999">Gregory Bataille</font><br></div></div></div></div>
<br><div class="gmail_quote">On Sun, Apr 23, 2017 at 7:55 AM, John W. Glendening <span dir="ltr"><<a href="mailto:glendening@drjack.net" target="_blank">glendening@drjack.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I have been creating a tileset from a .vrt based upon .tif files using<br>
gdal2tiles.py. The .tif files consist of lines overlaid upon a<br>
background map but I now want to eliminate the background map,<br>
i.e. make that area transparent, so the tiles will have only the lines<br>
on a transparent background, so they can be used as an overlay.<br>
<br>
I successfully produced the desired .tif files with transparent<br>
background and created a .vrt. But using gdal2tiles.py gives a black<br>
background (RGBA=0,0,0,255) where a transparent background is<br>
expected. (The expected lines _are_ present, on top of the black<br>
background.)<br>
<br>
Thinking that there might be a problem with the gdal2tiles.py<br>
interpretation of the .vrt, I used gdal_translate to convert it to a<br>
(large!) .png file and used that as the gdal2tiles.py argument<br>
instead. But the background remains black. As a check of the png<br>
file, I used gdal_translate to crop out and view a section and its<br>
background was indeed transparent (RGBA=0,0,0,0) in the expected<br>
places.<br>
<br>
I also tried two other variants of the gdal2tiles.py file that I found<br>
on the web, one from osgeo (with a 2013 copyright) and one from a<br>
geophython site - with identical results.<br>
<br>
I'm hoping for some guidance here.<br>
<br>
FYI an extract of gdalinfo for the .vrt file is:<br>
Driver: VRT/Virtual Raster<br>
Files: 24ksections.vrt<br>
/home/glendeni/HIKES/TRAILMAP/<wbr>TILES/BigSurTrailmap-<wbr>sectionA1-map.tif<br>
...<br>
Size is 37840, 48993<br>
Coordinate System is:<br>
PROJCS["unnamed",<br>
GEOGCS["unnamedellipse",<br>
DATUM["unknown",<br>
SPHEROID["unnamed",6378137,0]]<wbr>,<br>
PRIMEM["Greenwich",0],<br>
UNIT["degree",0.<wbr>0174532925199433]],<br>
PROJECTION["Mercator_1SP"],<br>
PARAMETER["central_meridian",<wbr>0],<br>
PARAMETER["scale_factor",1],<br>
PARAMETER["false_easting",0],<br>
PARAMETER["false_northing",0],<br>
UNIT["metre",1,<br>
AUTHORITY["EPSG","9001"]]]<br>
Origin = (-13565727.275918338447809,<wbr>4356632.541813874617219)<br>
Pixel Size = (1.836533043499999,-1.<wbr>836542168400001)<br>
Corner Coordinates:<br>
Upper Left (-13565727.276, 4356632.542) (121d51'46.81"W,<br>
36d24'21.64"N)<br>
Lower Left (-13565727.276, 4266654.831) (121d51'46.81"W, 35d45'<br>
9.94"N)<br>
Upper Right (-13496232.866, 4356632.542) (121d14'19.40"W,<br>
36d24'21.64"N)<br>
Lower Right (-13496232.866, 4266654.831) (121d14'19.40"W, 35d45'<br>
9.94"N)<br>
Center (-13530980.071, 4311643.687) (121d33' 3.10"W, 36d<br>
4'48.23"N)<br>
Band 1 Block=128x128 Type=UInt16, ColorInterp=Red<br>
Band 2 Block=128x128 Type=UInt16, ColorInterp=Green<br>
Band 3 Block=128x128 Type=UInt16, ColorInterp=Blue<br>
Band 4 Block=128x128 Type=UInt16, ColorInterp=Alpha<br>
<br>
The gdalinfo for the .png created by gdal_translate from the .vrt is:<br>
Driver: PNG/Portable Network Graphics<br>
Files: 24ksections.png<br>
24ksections.png.aux.xml<br>
Size is 37840, 48993<br>
Coordinate System is:<br>
PROJCS["unnamed",<br>
GEOGCS["unnamedellipse",<br>
DATUM["unknown",<br>
SPHEROID["unnamed",6378137,0]]<wbr>,<br>
PRIMEM["Greenwich",0],<br>
UNIT["degree",0.<wbr>0174532925199433]],<br>
PROJECTION["Mercator_1SP"],<br>
PARAMETER["central_meridian",<wbr>0],<br>
PARAMETER["scale_factor",1],<br>
PARAMETER["false_easting",0],<br>
PARAMETER["false_northing",0],<br>
UNIT["metre",1,<br>
AUTHORITY["EPSG","9001"]]]<br>
Origin = (-13565727.275918338447809,<wbr>4356632.541813874617219)<br>
Pixel Size = (1.836533043499999,-1.<wbr>836542168400001)<br>
Image Structure Metadata:<br>
INTERLEAVE=PIXEL<br>
Corner Coordinates:<br>
Upper Left (-13565727.276, 4356632.542) (121d51'46.81"W,<br>
36d24'21.64"N)<br>
Lower Left (-13565727.276, 4266654.831) (121d51'46.81"W, 35d45'<br>
9.94"N)<br>
Upper Right (-13496232.866, 4356632.542) (121d14'19.40"W,<br>
36d24'21.64"N)<br>
Lower Right (-13496232.866, 4266654.831) (121d14'19.40"W, 35d45'<br>
9.94"N)<br>
Center (-13530980.071, 4311643.687) (121d33' 3.10"W, 36d<br>
4'48.23"N)<br>
Band 1 Block=37840x1 Type=UInt16, ColorInterp=Red<br>
Band 2 Block=37840x1 Type=UInt16, ColorInterp=Green<br>
Band 3 Block=37840x1 Type=UInt16, ColorInterp=Blue<br>
Band 4 Block=37840x1 Type=UInt16, ColorInterp=Alpha<br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
--<br>
John W. (Jack) Glendening<br>
<br>
______________________________<wbr>_________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev" rel="noreferrer" target="_blank">https://lists.osgeo.org/<wbr>mailman/listinfo/gdal-dev</a></font></span></blockquote></div><br></div>