[Gdal-dev] Having problems with gdaladdo

Frank Warmerdam warmerdam at pobox.com
Sat Oct 15 18:17:16 EDT 2005


On 10/13/05, Steven Bowden <steveb at bundaberg.qld.gov.au> wrote:
> Hi List,
>
> I am relatively new to using gdal to process my orthophotos.  I am using
> mapserver to publish the orthos in a web app.
>
> I am trying to use gdaladdo to create the overviews for the tif files but I am
> getting some strange results in the tif files after I have created the
> overviews.  The second last overview is corrupted and the last/smallest
> overview always has a yellow square in the bottom right right hand corner of
> the image.

Steven,

I have found this problem and committed a fix.  The bug is pretty
serious and is due to the "final block" flushing logic not ensuring
that the block was being written to the correct overview.  I think
this bug has existed for quite a while, though it would only popup
sometimes when writing pixel-interleaved multiple overviews.

So, the fix is in CVS but you can apply it to your code too if needed.
Just call SetDirectory() in GTiffDataset::FlushBlockBuf()

CPLErr GTiffDataset::FlushBlockBuf()

{
    int		nBlockBufSize;
    CPLErr      eErr = CE_None;

    if( nLoadedBlock < 0 || !bLoadedBlockDirty )
        return CE_None;

    SetDirectory();   <-- add this line

    if( TIFFIsTiled(hTIFF) )
        nBlockBufSize = TIFFTileSize( hTIFF );
    else
        nBlockBufSize = TIFFStripSize( hTIFF );

Thanks for bringing this to my attention.

Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent




More information about the Gdal-dev mailing list