Masking layers by a vector polygon layer in QGIS Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?Is there a way to hillshade vector polygons with a DEM in QGIS?Exporting a QGIS layout with Addition on layersTransparency on black/white raster after clipping in QGIS?C++ QGIS Conditional Label ColouringMerge and export two layers that utilize blending modesPyQGIS: vector layer does not get displayed after renderingCan I use a polygon to show a WMS-layer inside while maintaining transparency outside?Calculate Density in QGISCombine raster (monocromatic and RGB image)Creating QGIS map that can be exported and used for 2-colour (spot) printing?

What causes the vertical darker bands in my photo?

Should I call the interviewer directly, if HR aren't responding?

Should I discuss the type of campaign with my players?

Models of set theory where not every set can be linearly ordered

How widely used is the term Treppenwitz? Is it something that most Germans know?

I am not a queen, who am I?

Right-skewed distribution with mean equals to mode?

Do you forfeit tax refunds/credits if you aren't required to and don't file by April 15?

Bonus calculation: Am I making a mountain out of a molehill?

Sorting numerically

Storing hydrofluoric acid before the invention of plastics

What LEGO pieces have "real-world" functionality?

How to do this path/lattice with tikz

Diagram with tikz

How do I stop a creek from eroding my steep embankment?

How to motivate offshore teams and trust them to deliver?

Why does Python start at index -1 when indexing a list from the end?

Determinant is linear as a function of each of the rows of the matrix.

Is there any avatar supposed to be born between the death of Krishna and the birth of Kalki?

What is a Meta algorithm?

Why is there no army of Iron-Mans in the MCU?

What does '1 unit of lemon juice' mean in a grandma's drink recipe?

Proof involving the spectral radius and the Jordan canonical form

Check which numbers satisfy the condition [A*B*C = A! + B! + C!]



Masking layers by a vector polygon layer in QGIS



Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
Announcing the arrival of Valued Associate #679: Cesar Manara
Unicorn Meta Zoo #1: Why another podcast?Is there a way to hillshade vector polygons with a DEM in QGIS?Exporting a QGIS layout with Addition on layersTransparency on black/white raster after clipping in QGIS?C++ QGIS Conditional Label ColouringMerge and export two layers that utilize blending modesPyQGIS: vector layer does not get displayed after renderingCan I use a polygon to show a WMS-layer inside while maintaining transparency outside?Calculate Density in QGISCombine raster (monocromatic and RGB image)Creating QGIS map that can be exported and used for 2-colour (spot) printing?



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








4















I have a vector layer of buildings:



enter image description here



and a polygon layer coloured by some quantity:



enter image description here



and I want to mask one by the other to produce this:



enter image description here



This can be done by setting the blend mode to "Multiply" with the building polygons on top as long as the polygons are white and the background of that layer is black.



One way of doing that is to use an "Inverted Polygons" fill but that is very slow at low zoom levels since all the buildings are in view and that's a lot of inverted polygons.



The other way I thought I'd cracked this was to create a "Group" layer with the buildings filled in white and a virtual layer consisting of the bounding box of the buldings filled in black. On its own it looks right:



enter image description here



but QGIS (3.6) doesn't let you blend grouped layers (Gimp and Photoshop probably do) so it doesn't work.



I really want to do it in the canvas so solutions involving processing intersections and creating new layers and so on aren't going to work either.



I'm not sure if I'm missing a trick to create a style for a layer to have a black background, or if there's something else in the blending modes that will do this...










share|improve this question




























    4















    I have a vector layer of buildings:



    enter image description here



    and a polygon layer coloured by some quantity:



    enter image description here



    and I want to mask one by the other to produce this:



    enter image description here



    This can be done by setting the blend mode to "Multiply" with the building polygons on top as long as the polygons are white and the background of that layer is black.



    One way of doing that is to use an "Inverted Polygons" fill but that is very slow at low zoom levels since all the buildings are in view and that's a lot of inverted polygons.



    The other way I thought I'd cracked this was to create a "Group" layer with the buildings filled in white and a virtual layer consisting of the bounding box of the buldings filled in black. On its own it looks right:



    enter image description here



    but QGIS (3.6) doesn't let you blend grouped layers (Gimp and Photoshop probably do) so it doesn't work.



    I really want to do it in the canvas so solutions involving processing intersections and creating new layers and so on aren't going to work either.



    I'm not sure if I'm missing a trick to create a style for a layer to have a black background, or if there's something else in the blending modes that will do this...










    share|improve this question
























      4












      4








      4








      I have a vector layer of buildings:



      enter image description here



      and a polygon layer coloured by some quantity:



      enter image description here



      and I want to mask one by the other to produce this:



      enter image description here



      This can be done by setting the blend mode to "Multiply" with the building polygons on top as long as the polygons are white and the background of that layer is black.



      One way of doing that is to use an "Inverted Polygons" fill but that is very slow at low zoom levels since all the buildings are in view and that's a lot of inverted polygons.



      The other way I thought I'd cracked this was to create a "Group" layer with the buildings filled in white and a virtual layer consisting of the bounding box of the buldings filled in black. On its own it looks right:



      enter image description here



      but QGIS (3.6) doesn't let you blend grouped layers (Gimp and Photoshop probably do) so it doesn't work.



      I really want to do it in the canvas so solutions involving processing intersections and creating new layers and so on aren't going to work either.



      I'm not sure if I'm missing a trick to create a style for a layer to have a black background, or if there's something else in the blending modes that will do this...










      share|improve this question














      I have a vector layer of buildings:



      enter image description here



      and a polygon layer coloured by some quantity:



      enter image description here



      and I want to mask one by the other to produce this:



      enter image description here



      This can be done by setting the blend mode to "Multiply" with the building polygons on top as long as the polygons are white and the background of that layer is black.



      One way of doing that is to use an "Inverted Polygons" fill but that is very slow at low zoom levels since all the buildings are in view and that's a lot of inverted polygons.



      The other way I thought I'd cracked this was to create a "Group" layer with the buildings filled in white and a virtual layer consisting of the bounding box of the buldings filled in black. On its own it looks right:



      enter image description here



      but QGIS (3.6) doesn't let you blend grouped layers (Gimp and Photoshop probably do) so it doesn't work.



      I really want to do it in the canvas so solutions involving processing intersections and creating new layers and so on aren't going to work either.



      I'm not sure if I'm missing a trick to create a style for a layer to have a black background, or if there's something else in the blending modes that will do this...







      qgis cartography masking






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Apr 1 at 16:27









      SpacedmanSpacedman

      25k23551




      25k23551




















          2 Answers
          2






          active

          oldest

          votes


















          5














          You can put the colored polygons on top, with a layer blending mode set to darken



          Below, have the building layer with the polygon fill in white.



          At the bottom, add a new layer containing one large black polygon.




          enter image description here



          Without the black background:



          enter image description here






          share|improve this answer























          • Bingo. Polygons on top just didn't occur to me! I can use my virtual bounding box layer as the black background.

            – Spacedman
            Apr 1 at 17:18


















          2














          Here's an alternate method for coloring the colored buildings to match the underlying zones.



          With Geometry Generator styling, create a separate symbol layer of buildings that intersect each of the zones.



          intersection($geometry, geometry(get_feature( 'zones', 'zoneNo', 1)))
          intersection($geometry, geometry(get_feature( 'zones', 'zoneNo', 2)))
          etc.


          enter image description here



          Change the color of each symbol layer to match the zone color. Create a black background, eg by setting the map canvas background color to black, or by changing the zone layer style to black-filled simple polygons.



          enter image description here



          Disclaimer: My test dataset was very small, so I have no idea if this will render faster than the inverted polygon method.






          share|improve this answer























          • That looks a bit long-winded for general use, but possibly useful in some instances... thanks.

            – Spacedman
            Apr 1 at 17:19











          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "79"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f317382%2fmasking-layers-by-a-vector-polygon-layer-in-qgis%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          5














          You can put the colored polygons on top, with a layer blending mode set to darken



          Below, have the building layer with the polygon fill in white.



          At the bottom, add a new layer containing one large black polygon.




          enter image description here



          Without the black background:



          enter image description here






          share|improve this answer























          • Bingo. Polygons on top just didn't occur to me! I can use my virtual bounding box layer as the black background.

            – Spacedman
            Apr 1 at 17:18















          5














          You can put the colored polygons on top, with a layer blending mode set to darken



          Below, have the building layer with the polygon fill in white.



          At the bottom, add a new layer containing one large black polygon.




          enter image description here



          Without the black background:



          enter image description here






          share|improve this answer























          • Bingo. Polygons on top just didn't occur to me! I can use my virtual bounding box layer as the black background.

            – Spacedman
            Apr 1 at 17:18













          5












          5








          5







          You can put the colored polygons on top, with a layer blending mode set to darken



          Below, have the building layer with the polygon fill in white.



          At the bottom, add a new layer containing one large black polygon.




          enter image description here



          Without the black background:



          enter image description here






          share|improve this answer













          You can put the colored polygons on top, with a layer blending mode set to darken



          Below, have the building layer with the polygon fill in white.



          At the bottom, add a new layer containing one large black polygon.




          enter image description here



          Without the black background:



          enter image description here







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Apr 1 at 16:58









          JGHJGH

          13.6k21239




          13.6k21239












          • Bingo. Polygons on top just didn't occur to me! I can use my virtual bounding box layer as the black background.

            – Spacedman
            Apr 1 at 17:18

















          • Bingo. Polygons on top just didn't occur to me! I can use my virtual bounding box layer as the black background.

            – Spacedman
            Apr 1 at 17:18
















          Bingo. Polygons on top just didn't occur to me! I can use my virtual bounding box layer as the black background.

          – Spacedman
          Apr 1 at 17:18





          Bingo. Polygons on top just didn't occur to me! I can use my virtual bounding box layer as the black background.

          – Spacedman
          Apr 1 at 17:18













          2














          Here's an alternate method for coloring the colored buildings to match the underlying zones.



          With Geometry Generator styling, create a separate symbol layer of buildings that intersect each of the zones.



          intersection($geometry, geometry(get_feature( 'zones', 'zoneNo', 1)))
          intersection($geometry, geometry(get_feature( 'zones', 'zoneNo', 2)))
          etc.


          enter image description here



          Change the color of each symbol layer to match the zone color. Create a black background, eg by setting the map canvas background color to black, or by changing the zone layer style to black-filled simple polygons.



          enter image description here



          Disclaimer: My test dataset was very small, so I have no idea if this will render faster than the inverted polygon method.






          share|improve this answer























          • That looks a bit long-winded for general use, but possibly useful in some instances... thanks.

            – Spacedman
            Apr 1 at 17:19















          2














          Here's an alternate method for coloring the colored buildings to match the underlying zones.



          With Geometry Generator styling, create a separate symbol layer of buildings that intersect each of the zones.



          intersection($geometry, geometry(get_feature( 'zones', 'zoneNo', 1)))
          intersection($geometry, geometry(get_feature( 'zones', 'zoneNo', 2)))
          etc.


          enter image description here



          Change the color of each symbol layer to match the zone color. Create a black background, eg by setting the map canvas background color to black, or by changing the zone layer style to black-filled simple polygons.



          enter image description here



          Disclaimer: My test dataset was very small, so I have no idea if this will render faster than the inverted polygon method.






          share|improve this answer























          • That looks a bit long-winded for general use, but possibly useful in some instances... thanks.

            – Spacedman
            Apr 1 at 17:19













          2












          2








          2







          Here's an alternate method for coloring the colored buildings to match the underlying zones.



          With Geometry Generator styling, create a separate symbol layer of buildings that intersect each of the zones.



          intersection($geometry, geometry(get_feature( 'zones', 'zoneNo', 1)))
          intersection($geometry, geometry(get_feature( 'zones', 'zoneNo', 2)))
          etc.


          enter image description here



          Change the color of each symbol layer to match the zone color. Create a black background, eg by setting the map canvas background color to black, or by changing the zone layer style to black-filled simple polygons.



          enter image description here



          Disclaimer: My test dataset was very small, so I have no idea if this will render faster than the inverted polygon method.






          share|improve this answer













          Here's an alternate method for coloring the colored buildings to match the underlying zones.



          With Geometry Generator styling, create a separate symbol layer of buildings that intersect each of the zones.



          intersection($geometry, geometry(get_feature( 'zones', 'zoneNo', 1)))
          intersection($geometry, geometry(get_feature( 'zones', 'zoneNo', 2)))
          etc.


          enter image description here



          Change the color of each symbol layer to match the zone color. Create a black background, eg by setting the map canvas background color to black, or by changing the zone layer style to black-filled simple polygons.



          enter image description here



          Disclaimer: My test dataset was very small, so I have no idea if this will render faster than the inverted polygon method.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Apr 1 at 16:59









          cskcsk

          9,8831035




          9,8831035












          • That looks a bit long-winded for general use, but possibly useful in some instances... thanks.

            – Spacedman
            Apr 1 at 17:19

















          • That looks a bit long-winded for general use, but possibly useful in some instances... thanks.

            – Spacedman
            Apr 1 at 17:19
















          That looks a bit long-winded for general use, but possibly useful in some instances... thanks.

          – Spacedman
          Apr 1 at 17:19





          That looks a bit long-winded for general use, but possibly useful in some instances... thanks.

          – Spacedman
          Apr 1 at 17:19

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Geographic Information Systems Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f317382%2fmasking-layers-by-a-vector-polygon-layer-in-qgis%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Adding axes to figuresAdding axes labels to LaTeX figuresLaTeX equivalent of ConTeXt buffersRotate a node but not its content: the case of the ellipse decorationHow to define the default vertical distance between nodes?TikZ scaling graphic and adjust node position and keep font sizeNumerical conditional within tikz keys?adding axes to shapesAlign axes across subfiguresAdding figures with a certain orderLine up nested tikz enviroments or how to get rid of themAdding axes labels to LaTeX figures

          Luettelo Yhdysvaltain laivaston lentotukialuksista Lähteet | Navigointivalikko

          Gary (muusikko) Sisällysluettelo Historia | Rockin' High | Lähteet | Aiheesta muualla | NavigointivalikkoInfobox OKTuomas "Gary" Keskinen Ancaran kitaristiksiProjekti Rockin' High