[gdal-dev] mask bands howto
Vincent Schut
schut at sarvision.nl
Thu Sep 25 07:06:51 EDT 2008
Thanks for the info, both.
Major lesson: after ds creation, first close it, than open it GA_Update,
then CreateMaskBand().
Another question: it seems (geotiff, external) masks are of dtype byte?
So they are not *bit*masks and will use 8 times more space than strictly
required (when no compression is used)? I thought the tiff spec allowed
for 1-bit datatypes (mainly used for fax data probably)...
And, apart from the wasted space (I use compression anyway), I'd like to
know the mask value conventions. I mean, a pixel in a mask could have
values from 0-255, not? Which one is True (masked), which one is
False(unmasked)? 'Cause if I give it a bool numpy array to write to the
mask (using gdal_array), it complains about incompatible datatypes...
Cheers,
Vincent.
Even Rouault wrote:
> You can also take inspiration from the python autotest suite :
> http://trac.osgeo.org/gdal/browser/trunk/autotest/gcore/mask.py
>
> Le Wednesday 24 September 2008 16:37:27 Vincent Schut, vous avez écrit :
>> Hi,
>>
>> is there any up-to-date documentation/tutorial available on the recently
>> added mask bands feature? I found
>> http://trac.osgeo.org/gdal/wiki/rfc15_nodatabitmask, but I was hoping
>> more on something like an api tutorial. The doxygen generated stuff all
>> is empty for mask related functions...
>>
>> Specifically, I'd like to know if it is possible to (using swig python)
>> create a DS (gtiff), and then write boolean data into
>> ds.GetRasterBand(1).GetMaskBand()? Or should I call CreateMaskBand
>> first? This is not entirely clear to me...
>>
>> Vincent.
>> _______________________________________________
>> gdal-dev mailing list
>> gdal-dev at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
>
>
More information about the gdal-dev
mailing list