On vendredi 1 juin 2018 18:25:27 CEST Sean Gillies wrote: > Hi Even, > > I got waylaid in following up, but am finally doing so now. Yes, I can also > confirm that the .msk file is being read over the internet. I'm grateful > for the CURL logging in GDAL, it's very handy. > > However, I'm perplexed by not being able to get the mask I expect from the > warped VRT I'm creating using GDALAutoCreateWarpedVRT. The source file has > a mask, but no mask materializes in the warped VRT. I have a WarpedVRT > class in Rasterio that calls GDALAutoCreateWarpedVRT and is equivalent to > the Python GDAL code you showed. It has a method that calls > GDALGetMaskFlags and here's what that reports. > > with rasterio.open('https://oin-hotosm.s3.amazonaws.com/ > 5a324a622553e6000ce5aaf5/0/3fa181a1-425c-4e53-b49f-ea72884da097.tif') as > src, WarpedVRT(src, dst_crs=src.crs) as vrt: > print(vrt.mask_flag_enums) > > # Output: > # ([<MaskFlags.all_valid: 1>], [<MaskFlags.all_valid: 1>], > [<MaskFlags.all_valid: 1>]) > > The source has a per-dataset mask, but this doesn't surface in the VRT. It > reports that all the pixels are valid.
Hi Sean, OK I now understand what you meant. The warper in general in GDAL (so not specific to the VRT warping) can use the mask of the input dataset, but doesn't generate one in output. However it should be able to generate an alpha band if you call GDALCreateWarpedVRT() with psOptions->nDstAlphaBand = 4 (couldn't test easily, but hopefully should work) Even -- Spatialys - Geospatial professional services http://www.spatialys.com _______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev