[gdal-dev] Problems writing big tiff image with RasterIO function

Jorge Martin jormarfe at gmail.com
Wed Nov 2 03:54:54 EDT 2011


 Hello,

      I am using an old version of the gdal library: 1.4.4.

      I have include below the code I used to write the tiff image:



 //-------------------------------------------------------------------------------------

    WriteImage(string aPath, int *myBuffer, int myNumLines, int myNumCols)
    {

    GDALRegister_GTiff();
    GDALDataset  *m_poDataset;
    const char *pszFormat = "GTiff";
    GDALDriver *poDriver;

    poDriver = GetGDALDriverManager()->GetDriverByName(pszFormat);

    if( poDriver == NULL ) return ( 0 );


    char **papszOptions = NULL;

    m_poDataset = poDriver->Create( aPath.c_str(), myNumColumns,
myNumLines,  1, GDT_Byte,
                                                    papszOptions );


    GDALRasterBand  *poBand = m_poDataset->GetRasterBand(1);

     poBand->RasterIO( GF_Write, 0, 0, myNumColumns, myNumLines,
                      myBuffer, myNumColumns, myNumLines, GDT_Int32, 0, 0 );


    GDALClose(m_poDataset);

    return 1;

   }



 //-------------------------------------------------------------------------------------



Best Regards,

Jorge

2011/10/31 Brian Claywell <bcclaywell at gmail.com>

> Jorge,
>
> On Mon, Oct 31, 2011 at 2:17 PM, Even Rouault
> <even.rouault at mines-paris.org> wrote:
> > Selon Jorge Martin <jormarfe at gmail.com>:
> >>        I am using RasterIO function to write tiff files. The problem
> >> appears when the image size is aprox. 25000x25000 (500Mb), the last
> lines
> >> of the image are not correctly written. The last lines are written with
> 0
> >> or 255 value. I have checked that if I only write a tiff file with the
> last
> >> lines of the image, this lines are correctly written.
> <snip>
> > You didn't mention your GDAL version. If it is not a recent one, you
> could try
> > upgrading and see if it works better.
>
> If you're seeing this behavior pre-1.8.1, it sounds similar to this
> bug, which has since been fixed:
> http://trac.osgeo.org/gdal/ticket/4090
>
> -b
>
> --
> Brian Claywell
> bcclaywell at gmail.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20111102/493731b2/attachment.html


More information about the gdal-dev mailing list