[gdal-dev] NODATA value in an array from RasterIO
Limei Ran
lran at unc.edu
Wed Mar 26 09:57:55 EDT 2008
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? 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?
Thank you a lot for your help,
Limei
Frank Warmerdam wrote:
> Limei Ran wrote:
>
>>
>> Hi:
>>
>> I am reading a region out from a band using RaterIO into an array.
>> What are NODATA cell values in the array? Are they 0 or something
>> else? Can I modify the array and write back to the image. How do I
>> keep NODATA values in the array to be on the image after writing?
>
>
> Limei,
>
> Nodata cells will have some particular pixel value. You can use the
> GetNoDataValue() method on a gdal.Band object to determine what it's
> nodata pixel value is. It should be None if there is no reserved
> nodata pixel value.
>
> How to preserve nodata pixels depends on the circumstances. Is your
> concern keeping nodata pixels unchanged through a series of arithmetic
> operations on the image array? Or setting the "nodata metadata" properly
> on the output dataset?
>
> Best regards,
More information about the gdal-dev
mailing list