[gdal-dev] [gdal 2.1] reordering band

Even Rouault even.rouault at spatialys.com
Wed Dec 14 06:51:55 PST 2016


On mercredi 14 décembre 2016 14:21:39 CET Vincent BERNAT wrote:
> Hi all,
> 
> 
> I got some products which have a wrong band ordering in raster but the good
> one in metadata.
> 
> In my c++ application, what are the gdal functions to call  to set the new
> band ordering ?
> 
> Is it possible?

Vincent,

Are you talking about the order of th band regarding their color interpretation ? You can 
indeed have Band 1 = Blue, Band 2 = Green, Band 3 = Red in some cases. GDAL drivers will not 
reorder them to be in R,G,B order. If you need this, you need to handle that at the application 
level, by for example issuing Dataset RasterIO with the 3,2,1 order. You could also create a 
VRT that reorder the bands.

gdal_translate -b 3 -b 2 -b 1 -of VRT in_bgr.tif out_rgb.vrt

(you can do that with GDALTranslate() API)

Even

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


More information about the gdal-dev mailing list