[gdal-dev] Extracting Subsampled Mask Band from VRT Returning 1st Band Rather Than Mask Band

Patrick Young patrick.mckendree.young at gmail.com
Wed May 15 12:51:00 PDT 2019


Sorry for the multiple messages, but one more data point.

If the VRT is composed of more than one image, everything seems to work.  I
can literally do a "gdalbuildvrt out.vrt in.tif in.tif" and "gdalinfo
out.vrt" on the multiple image VRT does not report the existence of
overviews (it does for the single image VRT).  Extracting the nodata mask
on out.vrt works (e.g. its not returning the first band of the image),
although I'm not sure if its just doing a nearest neighbor resampling of
the full resolution mask or if its implicitly cracking open the underlying
geotiff's overview level.  I suppose it's the former or I wouldn't see a
difference in behavior.

Is there some optimization in the VRT driver for when their is just a
single image in the source?  Even's blog post (
http://erouault.blogspot.com/2014/10/warping-overviews-and-warped-overviews.html)
on warped VRTs (see the last section of the post) makes me think its going
straight to the overviews in the single image case, but this is turned off
when more than one image composes the VRT.  Presumably the handling of
masks in the former case is where the problem lies.

Thanks for any clues!
Patrick

On Wed, May 15, 2019 at 11:17 AM Patrick Young <
patrick.mckendree.young at gmail.com> wrote:

> Hi all,
>
> I'm experiencing some strange behavior when extracting a mask band using
> gdal_translate from a VRT vs the source GTiff at a reduced resolution.  I
> have a 3 band, 8 bit JPEG compressed (YCbCR) RGB geotiff with an internal
> no data mask and with internal overviews.  Making a VRT of this and running
>
> gdal_translate -b mask in.vrt mask.tif
>
>
> Returns the expected no data mask.
>
> However, if I add in "-outsize 10% 0", I instead get the first band back
> as the mask tif rather than the mask band.  Any -outsize setting has the
> same effect.
>
> Repeating this with the source geotiff rather than the vrt works as
> expected.
>
> Interestingly, running
>
> gdalinfo -oo OVERVIEW_LEVEL=1 in.vrt
>
> reports no mask flags set at all (they are reported without the -oo
> option), but running on the original geotiff rather than the vrt does
> report the mask flags.
>
> Anyone have thoughts on what the VRT driver is doing?
>
> Thanks,
> Patrick
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20190515/65bf393a/attachment.html>


More information about the gdal-dev mailing list