[gdal-dev] Problem with image overview creation in GTiff files
Vincent Schut
schut at sarvision.nl
Mon Oct 20 03:52:03 EDT 2008
Frank Warmerdam wrote:
> Ozy Sjahputera wrote:
>> I am trying to create image overviews for a GTiff file using
>> GDALDataset::BuildOverviews. I keep getting various errors such as:
>>
>> ERROR 1: TIFFSetField:VISUAL.tif: Cannot modify tag "Compression"
>> while writing
> ...
>> writing
>> ERROR 1: TIFFSetField:VISUAL.tif: Cannot modify tag "TileLength" while
>> writing
>> ERROR 1: TIFFBuildOverviews:Can not write tiles to a stripped image
>>
>>
>> Here is my code:
>>
>> int OverviewList[5] = { 2, 4, 8, 16, 32 };
>> CPLErr overview_err = outDS->BuildOverviews( "AVERAGE_MAGPHASE", 5,
>> OverviewList, 0, NULL, NULL, NULL );
>>
>>
>> I have used BuildOverviews before on HFA images and they are fine. Any
>> idea?
>
> Ozy,
>
> I'm surprised. I wonder if you might have opened your file in read-only
> mode? Can you reproduce the problem with the gdaladdo commandline program?
>
> Best regards,
Frank,
I'm encountering this issue pretty frequently. It happens when I create
a tiled, compressed tiff (I'm using python but apparently that doesn't
make a difference), write tile data into it, and then call the
buildOverviews method. I thought I'd reported this issue (at least to
this list), but it might have slipped my mind. Because I've found and by
default implemented a fairly simple workaround, I totally forgot about
it till now. The workaround is simple: first close and reopen the
dataset, then buildOverviews. Haven't tried if flushing instead of
reopening is enough.
Should I file a ticket on this?
Vincent.
More information about the gdal-dev
mailing list