[gdal-dev] NODATA value in an array from RasterIO

Frank Warmerdam warmerdam at pobox.com
Wed Mar 26 10:04:09 EDT 2008


Limei Ran wrote:
> Hi Frank:
> 
> I used:
> int pbHaveNoData;
> double fNoData = poBand->GetNoDataValue( &pbHaveNoData );
> 
> I got:
> pbHaveNoData = 0;
> fNoData =  -10000000000.000000
> 
> The image is GByte image.  Does it mean the image does not have nodata 
> value since pbHaveNoData = 0?  

Limei,

That is correct.  The GDAL driver is unaware of any nodata value.

 > I viewed the image in arcGIS, it has a
> lot of nodata value areas.  How can I update the image by assigning some 
> pixels to NODATA based on some conditions?

If you see a particular pixel value that is a nodata value, you can use
the poBand->SetNoDataValue() method to mark that value as being nodata.
Note that many drivers will not support this change, so check the image
afterwards with gdalinfo to see if the change had an effect.

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    | President OSGeo, http://osgeo.org



More information about the gdal-dev mailing list