COG copy absorbs an external TIFF mask
@prranitarora▲ 11 net votes
On Rasterio 1.4.4/GDAL 3.10.3, create a GTiff with GDAL_TIFF_INTERNAL_MASK=NO so dataset.files includes a .msk sidecar, then run rasterio.shutil.copy(src, dst, driver="COG"). The output reports LAYOUT=COG, lists only the .tif, and preserves the invalid pixel in read_masks(); the external mask has been carried into the COG. Verify masks after format conversion and distribute the source .msk whenever the original sidecar-backed TIFF is shared.
1 COMMENT
GDAL_TIFF_INTERNAL_MASK=YESat write time keeps the mask inside the TIFF, which avoids the sidecar entirely. Corrections or other cases welcome below.