[gdal-dev] What is the best strategy for handling multiple banded tiffs

Even Rouault even.rouault at spatialys.com
Wed Apr 12 11:01:50 PDT 2017


On mercredi 12 avril 2017 13:23:06 CEST Stephen Woodbridge wrote:
> Hi all,
> 
> I'm reworking my code dealing with NAIP imagery that has R, G, B, IR
> bands, and I generate a mask band when reprojecting it. I also have the
> option to generate another computed band based on a sobel operator.
> 
> In the past, I separated them R, G, B, mask into jpeg ycbcr compressed
> tiff and had separate files for the IR, and the sobel data and used a
> VRT file to pull all these together into a single image for additional
> processing.
> 
> Ideally, I would like to have one file, rather than 4 files (RGB, IR,
> sobel, and the VRT) because over large areas the management of all these
> files is a pain. Also when displaying and working with large areas I
> need to mosaic the images into a seemless area using a vrt file or
> tileindex.
> 
> I need a way to display the various bands, and mapserver is my tool of
> choice, but I probably need to be able to display them via qgis also,
> which I have not experience with but reading older posts, I might need
> to create a vrt file. In mapserver I can select bands using PROCESSING
> options on layers.
> 
> Questions?
> 
> 1. Does it make sense to try and do this with one tiff with 6 bands?
> 2. What would be the best workflow for doing this? I'm thinking
> something like:
> 
> # remove any collar
> nearblack -co TILED=YES -of GTiff -nb 0 -near 0 -setmask -q -o temp1.tif
> doqq.tif
> 
> # warp to EPSG:4326 (does -dstalpha convert mask band to an alpha band?)

Yes

> gdalwarp -t_srs EPSG:4326 -dstalpha -co TILED=YES temp1.tif rgba.tif
> 
> # make sobel gray scale single band image
> makesobel.py rgba.tif sobel.tif
> 
> # create a temp.vrt file with bands R, G, B, Alpha|mask, IR, sobel
> 
> # and finally build a tif using the temp.vrt
> # I'm not sure what is the best way build the final tif given the mask
> # and whether I should use gdalwarp or gdal_translate for this step
> gdal_translate -co TILED=YES -co JPEG_QUALITY=90 -co COMPRESS=JPEG
> --CONFIG GDAL_TIFF_INTERNAL_MASK YES temp.vrt final.tif

--> This will only work as intended if there's a mask band identified as a mask and not an 
alpha band in the VRT.


> 
> # and build overviews
> gdaladdo -clean -r average final.tif 2 4 8 16 32 64 128
> 
> I'm not clear on how the mask band or alpha channel(band?) interacts
> with the various commands at each step in the workflow.
> 
> Thanks,
>    -Steve
> 
> ---
> This email has been checked for viruses by Avast antivirus software.
> https://www.avast.com/antivirus
> 
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev


-- 
Spatialys - Geospatial professional services
http://www.spatialys.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20170412/d9909fa9/attachment-0001.html>


More information about the gdal-dev mailing list