7

Is there a way to modify the style of a poygon .shp file so that everything except the polygon is rendered as shaded?

EDIT: see these images if you have trouble understanding. I am going for the effect in the second image.

inside shading outside shading

  • like setting the background colour of your map...? – DPSSpatial Jul 8 '15 at 19:43
  • Not sure I know what you mean — are you referring to the color swatch at Project > Project Properties > General > Background Color? If so, that's not what I want… OK suppose I have a DEM base layer and a semi-transparent hillshade rendering over it. I load in a .SHP file that contains a polygon which is a property boundary. I would like to, for example, have my polygon rendered with a "line pattern fill" exactly like I am able to do via Layer Properties > Style except that I would like the entire visible area outside the parcel to be shaded with the line pattern fill. – corvus Jul 9 '15 at 0:19
13

Yes.

You just have to do change the style of the polygon from "Single Symbol" to "Inverted polygons".

Here you can see a polygon with a solid fill using the "single symbol" style. polygon with single symbol solid fill style with a small transparency

The top left of the style tab in the properties window for the polygon layer is where you change it to "inverted polygons". how to change it to inverted polygons stlye in QGIS

Then you can hit OK and see it in the map. polygon displayed in QGIS using the inverted polygons style

It's fun to experiment with other polygon "simple fills" such as shapeburst. an inverted polygons styled polygon using a shapeburst symbol fill in QGIS

  • Thanks! Exactly what I needed. …and I was sure that there would be a simple solution! Kind of surprised I didn't figure it out myself, but I never noticed that menu option. – corvus Jul 9 '15 at 16:08
  • Can this method be applied to multiple layers at once? – corvus Jul 9 '15 at 16:33
  • @corvus I would probably just build a .vrt of the files and layers I need, then apply the inverted effect to the vrt layer. – SaultDon Jul 9 '15 at 22:03
2

Have you tried using the mask plugin? Set the style to inverted polygon and set the shapeburst fill to transparent. Set the layer transparency to the desired level. Before mask:enter image description here After mask: enter image description here

  • I figured this could be somehow accomplished with masking, but didn't know I needed a plugin. Thanks for showing how it's done — Definitely more elegant than my original solution! …Do you know if there is a way to create a mask from polygons in separate layers, or would I have to merge them into a new layer before masking? – corvus Jul 9 '15 at 16:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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