Setting a transparent layer fill
Sometimes, you may just want to display the outline of a polygon in a layer and have the insides of the polygon render transparently, so you can see the other features and background layers inside that space. For example, this technique is common with political boundaries. In this recipe, we will load a polygon layer onto the map, and then interactively change it to just an outline of the polygon.
Getting ready
Download the zipped shapefile and extract it to your qgis_data
directory into a folder named ms
from https://github.com/GeospatialPython/Learn/raw/master/Mississippi.zip.
How to do it...
In the following steps, we'll load a vector polygon layer, set up a properties dictionary to define the color and style, apply the properties to the layer's symbol, and repaint the layer. In Python Console, execute the following:
Create the polygon layer:
lyr = QgsVectorLayer("/qgis_data/ms/mississippi.shp", "Mississippi", "ogr"...