[gdal-dev] RFC 15: Band Masks vs #5621

Even Rouault even.rouault at spatialys.com
Wed Aug 20 01:28:14 PDT 2014


Ivan,

You can declare a mask flag to 0 to indicate that this is a per-band mask band.
This is perfectly legal.
You might decide either to set NBITS=1 as metadata to that mask band, or promote
it to full 8 bit (0->0, 1->255).
As far as which format natively supports that, I can't think to any. However the
generic handling in an external .msk file should be able to deal with that, so
hopefully CreateCopy() will generate a .msk file. FYI, as far as internal mask
is concerned, the TIFF specification only allows per-dataset masks (we support
in reading an extension to per-band masks, but we don't generate that)
The generic overview computation code should also be able to generate overviews
of mask band.
You can also play with VRT that should support per-dataset or per-band mask
band.
And you can have a look at autotest/gcore/mask.py to have a sense of what is
supported.

Even

> That question is probably for Even, Frank or some the developer of drivers
> that support mask band.
>
> I am working on ticket #5621 and trying to adapt it to the RFC 15 but I am
> not quite sure that I am getting it right.
>
> In GeoRaster, I can have a bitmap mask band that can be applied to all bands,
> similar to the concept of GMF_PER_DATASET, I guess. I can also have one
> bitmap mask band per raster band, but that does not correspond to the others
> mask flags (GMF_ALL_VALID, GMF_ALHA, GMF_NO_DATA). The data type of my bitmap
> mask is 1 bit, and there is no implicit connection with Alpha Channel or No
> Data in a binary bitmap mask, of course.
>
> So if I have a dataset with just one bitmap mask shared between all the
> bands, I think I can return the flag GMF_PER_DATASET and promote the values
> to GDT_BYTE. But if I have bitmap masks for each raster bands, then I don't
> know what flag to return. I might just lie and say "GMF_PER_DATASET" and when
> the mask is requested I will take care of returning the correct one.
>
> Would that works for others drivers participating on
> gdal_translate/CreateCopy()?
>
> Of course, if the output driver support just one mask per dataset, there is
> nothing much we can do.
>
> By the way, are there any driver that support overviews of mask band?
>
> Regards,
>
> Ivan
>


-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list