Creating flag bands in GPT graphs

Hi,

I need to attach a flag band into an existing product using a GPT graph. Preferably by first reading several 1-bit GeoTIFF bands from files (“masks”) and then add those into an existing product as flags. Is this possible using a GPT graph (if so, how)?

Best regards,
Vesa

To merge all the bands you can probably use the BandMerge operator if they cover the same are and have the same size. Otherwise you need to collocate them before.
The you can use BandMaths to create one band based on all the others, if you like.
But creating a real flag band with a flag coding is not possible.

Ok, thanks. I would have needed a real flag band with coding, instead of separate bands. Perhaps the flag band could be generated with a custom operator? Does the Java API have functionality for handling flags and flag coding? Some pointers to relevant API-documentation would be appreciated, if that approach seems feasible…

For creating a FlagCoding there are some examples on GitHub, for Java and for Python.
I think it is not necessary to implement an operator. A simple main method which reads the product, adds the FlagCoding and writes the product will do the job.
There are some more examples in the snap-examples repository.