[gdal-dev] GDALGetMaskFlags() bug with GTOPO30 data

Craig Bruce csbruce at cubewerx.com
Thu May 31 11:41:14 PDT 2012


I have run into a bug using GDALGetMaskFlags() with GTOPO30 data with
the GDAL 1.9.0 C API.  The test data includes a NoData value:

[dev:~] gdalinfo /cw/testdata/gtopo30/w180s60.dem
Driver: EHdr/ESRI .hdr Labelled
...
Band 1 Block=7200x1 Type=Int16, ColorInterp=Undefined
  NoData Value=-9999

When I call GDALGetMaskFlags(), I get back 0x01 which corresponds to
GMF_ALL_VALID, meaning that the image is fully opaque.  I was hoping to
discard the mask band in such a case as an optimization to avoid reading
mask samples.  However, it appears that the GDALGetMaskFlags() is returing
GMF_ALL_VALID by mistake and should be returning GMF_NODATA (0x08) instead.
If I use the mask returned from GDALGetMaskBand(), it gives me the proper,
variable mask values, so the bug is in falsely reporting the type of the
mask band.

--------------------------+----------------------+--------------------------
Dr. Craig S. Bruce        | Ph 819-771-8303 x205 |             CubeWerx Inc.
Senior Software Developer |   Fax 819-771-8388   |  Gatineau, Québec, Canada
csbruce at cubewerx.com      |  http://csbruce.com/ |  http://www.cubewerx.com/
--------------------------+----------------------+--------------------------
     "How many legs does a dog have if you call the tail a leg?  Four.
      Calling a tail a leg doesn't make it a leg." -- Abraham Lincoln


More information about the gdal-dev mailing list