<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>Hi Olivier,</p>
<p>Geotiff allows to have an alpha channel. You can create an alpha
channel from a vector layer, using gdalwarp.</p>
<p>Here is one of the commands I use:</p>
<p style="color: rgb(76, 76, 76); font-family: Verdana, Geneva,
sans-serif; font-size: 13.3333px; font-style: normal;
font-variant-ligatures: normal; font-variant-caps: normal;
font-weight: normal; letter-spacing: normal; orphans: 2;
text-align: start; text-indent: 0px; text-transform: none;
white-space: normal; widows: 2; word-spacing: 0px;
-webkit-text-stroke-width: 0px; background-color: rgb(255, 255,
255); text-decoration-style: initial; text-decoration-color:
initial;">gdalwarp -of GTiff --config GDAL_TIFF_INTERNAL_MASK YES
-wm 500 --config GDAL_CACHEMAX 500 -multi -wo NUM_THREADS=4 -wo
OPTIMIZE_SIZE=TRUE -cutline dop2016_lv95_cutline.gpkg
-crop_to_cutline -dstalpha -co "BIGTIFF=YES" -co "TILED=YES" -co
"COMPRESS=JPEG" -co "JPEG_QUALITY=85" -co "PHOTOMETRIC=RGB" -co
"SPARSE_OK=TRUE" dop2016_lv95_tmp.tif dop2016_lv95.tif</p>
note the parameters "-cutline vectorfile" -crop_to_cutline and
-dstalpha<br>
<br>
I know, it is not as easy and straight-forward as you may want it to
be, but it works. And of course it is not dynamic.<br>
<br>
Andreas<br class="Apple-interchange-newline">
<br>
<div class="moz-cite-prefix">On 27.06.2017 18:26, Olivier Dalang
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAExk7p0eGPmd4NJCZEjcsQ4RC7RTDB6PpNZBoHH-r5EfeW7O9g@mail.gmail.com">
<div dir="ltr">Dear List,
<div><br>
</div>
<div>I was wondering whether there is an easy solution to have
dynamic clipping masks for rasters, just like vector masks in
Photoshop (or similar software) ?</div>
<div><br>
</div>
<div>For now, I was using a layer with the inverted polygon
renderer to hide with a white layer everything that is outside
of the polygon. This works great, but then it's not possible
to show anything behind the raster.</div>
<div><br>
</div>
<div>I know it's easy to statically clip a raster, but this is
not usable when working with some rasters types (eg. xyz
tiles). Also it's not optimal, as the hidden area is still
rendered. And it requires to write a copy of the layer, which
can be slow and/or use a lot of disk space.<br>
</div>
<div><br>
</div>
<div>Thanks !!</div>
<div><br>
</div>
<div>Olivier</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Qgis-user mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a>
List info: <a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-user">https://lists.osgeo.org/mailman/listinfo/qgis-user</a>
Unsubscribe: <a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-user">https://lists.osgeo.org/mailman/listinfo/qgis-user</a></pre>
</blockquote>
<br>
</body>
</html>