cogeotiff / www.cogeo.org

Cloud Optimized GeoTIFF website
http://cogeo.org
Apache License 2.0
90 stars 37 forks source link

[qgis tutorial] transparency in gdalbuildvrt command #9

Closed landryb closed 6 years ago

landryb commented 6 years ago

It's somewhat easy to handle transparency, but that depends on the remote data you're looking at. In your case, adding -srcnodata 0 to the gdalbuildvrt command tells gdal to consider pixels with 0 value (ie real black) as transparent, which gives the following here: https://i.imgur.com/Feca8ny.png.

The BG is red in my QGIS precisely for this, to see if data is transparent..

Of course, this has some drawbacks,cf https://i.imgur.com/4EamrFS.png:

Sadly, those shortcomings can only be fixed "at the source"..

landryb commented 6 years ago

The other option is to create an intermediate VRT manually clipping the area where you know you have no data... but as long as your source image doesnt ship with an alpha channel or a NODATA value in its bands, it's hard to workaround this..

cholmes commented 6 years ago

Sorry for the super long response on this, my github filters sometimes just lose the notifications. But thanks so much! Just added it in. It does seem to not be the best solution, with the transparent pixels inside the image.

Hopefully we can figure out better handling of nodata values, perhaps using SpatioTemporal Asset Catalogs in conjunction with COG's. cc @mojodna as I think he was just telling me about this problem.