<div dir="ltr">Hi Even,<div><br></div><div>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.</div><div><br></div><div>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.</div><div><br></div><div><div>with rasterio.open('<a href="https://oin-hotosm.s3.amazonaws.com/5a324a622553e6000ce5aaf5/0/3fa181a1-425c-4e53-b49f-ea72884da097.tif" target="_blank">https://oin-<wbr>hotosm.s3.amazonaws.com/<wbr>5a324a622553e6000ce5aaf5/0/<wbr>3fa181a1-425c-4e53-b49f-<wbr>ea72884da097.tif</a>') as src, WarpedVRT(src, dst_crs=src.crs) as vrt:<br></div><div> print(vrt.mask_flag_enums)</div></div><div><br></div><div># Output:</div># ([<MaskFlags.all_valid: 1>], [<MaskFlags.all_valid: 1>], [<MaskFlags.all_valid: 1>])<div><br></div><div>The source has a per-dataset mask, but this doesn't surface in the VRT. It reports that all the pixels are valid.</div><div><br></div><div>Is this the intended behavior for VRTs? Are we required to materialize the VRT and create an alpha band to contain the derived mask?</div><div><br></div><div>Thanks,</div><div><br><div><div class="gmail_extra"><div class="gmail_quote">On Tue, Feb 20, 2018 at 4:57 AM, Even Rouault <span dir="ltr"><<a href="mailto:even.rouault@spatialys.com" target="_blank">even.rouault@spatialys.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><u></u>
<div style="font-family:"Sans Serif";font-size:9pt;font-weight:400;font-style:normal">
<p style="margin:0px;text-indent:0px">Sean,</p>
<p style="margin:0px;text-indent:0px"> </p>
<p style="margin:0px;text-indent:0px">I've just tested with GDAL trunk and latest state of 2.2 branch (but I think that 2.2.2 should behave the same), and when using gdal.AutoCreateWarpedVRT() on your below mentionned dataset, the .msk file is read.</p>
<p style="margin:0px;text-indent:0px"> </p>
<p style="margin:0px;text-indent:0px">$ CPL_CURL_VERBOSE=YES CPL_VSIL_CURL_ALLOWED_EXTENSIO<wbr>NS=tif,msk FILE=/vsicurl/<a href="http://oin-hotosm.s3.amazonaws.com/5a324a622553e6000ce5aaf5/0/3fa181a1-425c-4e53-b49f-ea72884da097.tif" target="_blank">http://oin-hotos<wbr>m.s3.amazonaws.com/5a324a62255<wbr>3e6000ce5aaf5/0/3fa181a1-425c-<wbr>4e53-b49f-ea72884da097.tif</a> python</p>
<p style="margin:0px;text-indent:0px">[...]</p>
<p style="margin:0px;text-indent:0px">>>> from osgeo import gdal</p>
<p style="margin:0px;text-indent:0px">>> import os</p>
<p style="margin:0px;text-indent:0px">>>> file = os.getenv('FILE')</p>
<p style="margin:0px;text-indent:0px">>>> src_ds = gdal.Open(file)</p>
<p style="margin:0px;text-indent:0px">[...]</p>
<p style="margin:0px;text-indent:0px">>>> ds = gdal.AutoCreateWarpedVRT(src_d<wbr>s)</p>
<p style="margin:0px;text-indent:0px">[...]</p>
<p style="margin:0px;text-indent:0px">* Connected to <a href="http://oin-hotosm.s3.amazonaws.com" target="_blank">oin-hotosm.s3.amazonaws.com</a> (52.216.130.219) port 80 (#2)</p>
<p style="margin:0px;text-indent:0px">> GET /5a324a622553e6000ce5aaf5/0/3f<wbr>a181a1-425c-4e53-b49f-ea72884d<wbr>a097.tif.msk HTTP/1.1</p>
<p style="margin:0px;text-indent:0px">Host: <a href="http://oin-hotosm.s3.amazonaws.com" target="_blank">oin-hotosm.s3.amazonaws.com</a></p>
<p style="margin:0px;text-indent:0px">Range: bytes=49152-114687</p>
<p style="margin:0px;text-indent:0px">Accept: */*</p>
<p style="margin:0px;text-indent:0px"> </p>
<p style="margin:0px;text-indent:0px">< HTTP/1.1 206 Partial Content</p>
<p style="margin:0px;text-indent:0px">< x-amz-id-2: oXRmqP1A9HzNTn9soSOh9vQJzGUa+l<wbr>A0GbsAKa0m51H8wvZCgS31y85NAXu6<wbr>0r3MMjRTz1TssYk=</p>
<p style="margin:0px;text-indent:0px">< x-amz-request-id: BC46544B595F1D30</p>
<p style="margin:0px;text-indent:0px">< Date: Tue, 20 Feb 2018 11:52:54 GMT</p>
<p style="margin:0px;text-indent:0px">< Last-Modified: Thu, 14 Dec 2017 09:58:29 GMT</p>
<p style="margin:0px;text-indent:0px">< ETag: "97b96b954a22be9d7bae0bfd1f339<wbr>22b"</p>
<p style="margin:0px;text-indent:0px">< Accept-Ranges: bytes</p>
<p style="margin:0px;text-indent:0px">< Content-Range: bytes 49152-114687/1730078</p>
<p style="margin:0px;text-indent:0px">< Content-Type: binary/octet-stream</p>
<p style="margin:0px;text-indent:0px">< Content-Length: 65536</p>
<p style="margin:0px;text-indent:0px">< Server: AmazonS3</p>
<p style="margin:0px;text-indent:0px"> </p>
<p style="margin:0px;text-indent:0px">[...]</p><span>
<p style="margin:0px;text-indent:0px"> </p>
<p style="margin:0px;text-indent:0px">Even</p>
<p style="margin:0px;text-indent:0px"> </p>
<p style="margin:0px;text-indent:0px">-- </p>
<p style="margin:0px;text-indent:0px">Spatialys - Geospatial professional services</p>
<p style="margin:0px;text-indent:0px"><a href="http://www.spatialys.com" target="_blank">http://www.spatialys.com</a></p></span></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="m_8534722013091844394gmail-m_2682177983177421487gmail_signature"><div dir="ltr">Sean Gillies</div></div>
</div></div></div></div>