[gdal-dev] Storing mask as part of the *.ovr file

Denis Rykov rykovd at gmail.com
Wed Apr 22 15:22:39 PDT 2020


Thanks Even! I'll give it a try.

Could you please help me understand the difference between two next cases.
When I do either

    gdal_translate rgbmask.vrt rgb_with_external_msk.vrt -mask none -b 1 -b
2 -b 3 -of VRT
    or
    gdal_translate rgbmask.vrt rgb_with_external_msk.vrt -mask none -of VRT

I'm getting the same (I would say expected) result: VRT raster with 3
VRTRasterBand / 1  SimpleSource element per each band.

But if I do:

    gdal_translate rgbmask.vrt rgb_with_external_msk.vrt -mask none -b 1 -b
2 -b 3 -of VRT

I'm getting VRT with:

1) 3 VRTRasterBand + 1 MaskBand
2) Each VRTRasterBand has many SimpleSource elements with various DstRect.

So it seems if we don't tell to GDAL not to use mask it copies it by
default. But why the structure of VRTRasterBand is different?



On Wed, Apr 22, 2020 at 12:09 PM Even Rouault <even.rouault at spatialys.com>
wrote:

> On mardi 21 avril 2020 23:54:03 CEST Denis Rykov wrote:
>
> > Hello,
>
> >
>
> > I'm using *.vrt file that is built atop of COG rasters with internal mask
>
> > (PER_DATASET) + external overview file *.vrt.ovr.
>
> > These files are stored on Azure Blob Storage and I get access to them
> using
>
> > /vsiaz scheme.
>
> > I've found out that when I read data from this VRT GDAL does few requests
>
> > to *.vrt.ovr to get data and lots of requests to TIFFs to extract a mask.
>
> >
>
> > What are the ways to overcome this? I hope I can put mask into
>
> > sidecar *.vrt.msk file. Is that correct?
>
> > Is there a way to store a mask inside a *.vrt.ovr file?
>
>
>
> Hum, given a rgbmask.vrt that has a mask band, the following probably works
>
>
>
> gdal_translate rgbmask.vrt rgb_with_external_msk.vrt -b 1 -b 2 -b 3 -of VRT
>
> gdal_translate rgbmask.vrt rgb_with_external_msk.vrt.msk -b mask -of VRT
> -mo INTERNAL_MASK_FLAGS_1=2 -mo INTERNAL_MASK_FLAGS_2=2 -mo
> INTERNAL_MASK_FLAGS_3=2
>
> gdaladdo rgb_with_external_msk.vrt.msk
>
>
>
> You could probably avoid rgb_with_external_msk.vrt referencing
> rgbmask.vrt, by making it directly refer to your COG sources.
>
>
>
> Even
>
>
>
>
>
> --
>
> Spatialys - Geospatial professional services
>
> http://www.spatialys.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20200423/cc67c2e7/attachment.html>


More information about the gdal-dev mailing list