[gdal-dev] gdal_translate -expand rgb incompatible with geotiff COPY_SRC_OVERVIEWS

Vincent Schut schut at sarvision.nl
Thu Dec 30 05:52:34 EST 2010


Hi all,

Kind of a corner case, but i was hoping that gdal_translate's -expand 
option (to expand colorindexed 1-band files into 3-band rgb files) would 
also copy and expand the overviews when run with the (geotiff specific, 
I know) create option "-co COPY_SRC_OVERVIEWS=YES". It appears to not do 
so, and just discards the overviews. Would this be a bug, or maybe a 
feature to add?

Use case: for a classified, indexed image, I have built overviews using 
the 'mode' operator, which is obviously the most usefull for this kind 
of image, and only applicable on 1-band indexed data. I want to have a 
rgb version of this, but with those overviews, so the overviews should 
be an rgb version of the 'mode' overviews of the original. It is 
impossible to create the same overviews once the image has been expanded 
into rgb; mode will result in wrong, and sometimes even weird results (I 
presume mode works band-wise), and average and partners will result in 
colors that are not defined in the original colorindex (which I want to 
avoid, we are talking maps and legends here).

I think I can work around this by creating a separate file for each 
overview level (bla.ovr, bla.ovr.ovr, and so on), expanding those, and 
than using copy_src_overviews to create one file with internal overviews 
again, but this feels kind of awkward, and the above seemed so elegant...

Vincent.


More information about the gdal-dev mailing list