[Gdal-dev] RasterIO: replicating a value

Frank Warmerdam fwarmerdam at gmail.com
Wed Feb 16 17:32:48 EST 2005


On Wed, 16 Feb 2005 11:47:52 -0800, Carlos A. Rueda <carueda at ucdavis.edu> wrote:
> Hello,
> 
> I'm trying to make only one call to RasterIO in a 1-band dataset
> to fill a region with the same value. This is just an example:
> 
> GDALDataset* dataset = hDriver->Create(
>     filename,
>     1000,       //nXSize
>     1000,       //nYSize
>     1,          //nBands
>     GDT_Int32,  //GDALDataType
>     NULL        //papszParmList
> );
> int value = 1234;     // GDT_Int32 in my machine
> dataset->RasterIO(
>      GF_Write,
>      0,            //nXOff,
>      0,             //nYOff,
>      200,           //nXSize,
>      300,           //nYSize,
>      &value,        //pData,
>      1,             //nBufXSize,
>      1,             //nBufYSize,
>      GDT_Int32,     //eBufType,
>      1,             //nBandCount,
>      NULL,          //panBandMap,
>      0,             //nPixelSpace,
>      0,             //nLineSpace,
>      0              //nBandSpace
> );
> 
> Is this the right way to obtain the value replicated
> 200x300 times in the upper left region of the dataset?

Carlos, 

This looks fine, are you having a problem with it? 

I would add there is a Fill() method on the GDALRasterBand if
you find you need to fill the whole thing. 

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