In QGIS 3.22.5, is there possible to use polygons for the masking layer? I want to use numerous little polygons to mask lines (only layer which consists of lines).

In ArcGIS that works just by clicking the layers you want to use in "appearance -> masking".

For example in QGIS: labels can be created as masks which work fine.


enter image description here

I hope that picture in above explain what I'm looking for. Polygon (red) masking lines (black) and result is in right side picture.

  • If you create your "masking" polygons in their own layer, symbolize them as white with no outline and have that layer just above your lines layer in the layers panel, they should block seeing the lines.
    – John
    Commented Jun 1, 2022 at 12:54

2 Answers 2


In QGIS version 3.24, it is now possible to mask layers using other layers. It is necessary to create a group of layers, where the mask layer and the masked layer will be located.

  1. In the layers panel, select a group and enable the "Render layers as a group" option for it: enter image description here

  2. In the layers panel, select the mask layer and set the appropriate blending mode for it: enter image description here

It's done! https://qgis.org/ru/site/forusers/visualchangelog324/index.html#feature-rendering-layers-as-groups

EDIT: To mask a raster layer, there must be two vector layers in the group. One vector layer is a mask. The second vector layer is any other (even empty).

  • As of QGIS 3.38 you don't seem to need a second vector layer over a raster layer, it works as expected? Also thanks a ton for this suggestion, this really saved the day with my XYZ raster source that I can't clip using the regular gdal tools!
    – eresonance
    Commented Jul 10 at 3:19

You are looking for the Difference tool:

Extracts features from the input layer that don’t fall within the boundaries of the overlay layer.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.