QGIS tips - building a map background

Dordogne

I had a query today from someone who wants to use QGIS to show distribution maps of butterflies and moths for the Dordogne in France. His question was about presenting a detailed background. Sourcing and creating map layers to build good looking backgrounds for distribution maps is probably one of the major hurdles for biological recorders wishing to use GIS to create distribution maps. To help answer his question I had a go at it myself and I thought it worth sharing what I found.

For an area like the Dordogne, some of the freely available maps built on the OpenStreetMap (OSM) data would probably be suitable for static maps (i.e. non-interactive maps). Several nicely themed OSM maps can be very easily viewed within QGIS where they are accessible as Web Mapping Services (WMS) via a number of plugins - the one I use is QuickMapServices (with the 'contributed pack' installed). 

OSM TF Landscape theme for Dordogne area

Using one of these themes I had a quick look at the Dordogne area (after finding out where it was!) and, as you can see, that there is sufficient detail to provide useful context as background to a distribution atlas map. One of the great things about these OSM maps is that the licensing is very open (https://opendatacommons.org/licenses/odbl/summary/) meaning that you can freely publish any maps you create from them, virtually without restriction. The OSM map shown above is from the 'OSM TF Landscape' theme available from QuickMapServices.

The most difficult task would to source a vector layer that described the boundary of the Dordogne region - what they call a 'department' in France (Dordogne is department 24). Being unfamiliar with French geospatial data and sources for it (as well as the language) I had to do a bit of trawling around, but I eventually found a vector dataset, downloadable as a Shapefile, that described all the small administrative areas of France known as 'communes' - all 35,000 plus of them.

Vector map with Dordogne communes selected

And the great thing about this vector layer is its attributes - there are a good number including one, 'NOM_DEPT' which had the name of the department to which each commune belonged. So I was able to use QGIS' 'Select features using an expression' feature to select all the regions that belonged to the Dordogne (see map above). Then I saved the selected features to a new layer and used the vector processing tool 'Dissolve'  on this layer to create a new layer representing then region of Dordogne. This is shown on the map below, styled to remove the 'fill' removed and showing a slightly thicker black line for the boundary.

Vector layer showing the boundary of the Dordogne

Now I could see the OSM background in relation to the boundary of the Dordogne, I tried one or two other OSM map themes from the QuickMap tool and I decided that I preferred the OSM theme 'Wikimedia map' which is shown below.

Dordogne vector overlaying Wikimedia map OSM

There are a couple of final touches I wanted to make to this atlas map background. The first is to 'fade out' the map background surrounding the Dordogne. I did this by creating a new vector layer of polygon topology, setting my 'advanced snapping options' to 'avoid intersections' for both the Dordogne layer and this new mask layer. Then I zoomed the map out a bit and digitised a very large rectangle over a wide area around the Dordogne. When I completed the capture with a right-click of the mouse, QGIS 'cookie-cut' a Dordogne-shaped hole from the middle of my mask layer (because I had specified 'avoid intersections'). Note that for this to work, both layers have to use the same CRS. My Dordogne layer had the CRS 'RGF93 / Lambert-93' since that is what the original Commune shapefile used. So I needed to make sure that when I created the mask layer, I specified this as the CRS.

Dordogne with semi-transparent mask vector layer

By styling the mask layer so that it has a white, semi-transparent background I'm able to 'fade out' the background map outside of the immediate area of interest. By adjusting the transparency, I can have this as strong or as faded as I like.

Finally I wanted to put a coarse 10 km grid over the map. This is where some careful thought is required. It's easy in the UK since we almost always work to the British National Grid, but in other parts of the world there may be more than one option. Despite the fact that the vector maps have the internal CRS of 'RGF93 / Lambert-93' I actually chose to re-project the maps shown above with 'WGS 84 / Pseudo Mercator' in the QGIS map view since the OSM raster data displays best with this projection.

Tom.bio OSGR tool - user specified grid sizeBut the grid needs to be created using the same projection as the atlas project is using in order to give the correct frame of reference for the atlas maps. Assuming the atlas project is to be created for the CRS 'RGF93 / Lambert-93', we first need to set the map view CRS to the same value if we want to create the grid using the Tom.bio OSGR tools. Then we can set the precision drop-down to 'user specified' and set the grid size to '10000' (see illustration on the right). Generate grid squares over selected feature buttonNote that the grid size is in map units and the map units for both 'RGF93 / Lambert-93' and 'WGS 84 / Pseudo Mercator' is metres. Then all that remains is to select the Dordogne polygon and click the button to automatically generate grid squares overlapping the selected feature. The resulting grid is shown below (with the map projected with 'RGF93 / Lambert-93').

10 km grid over Dordogne

Note the slight loss of definition with the OSM backdrop when it is re-projected to a CRS other than 'WGS 84 / Pseudo Mercator'. There are two possible ways to overcome this if it is considered a problem - either source a version of the OSM mapping (or some other backdrop) that works better with this projection (for example you could get vector OSM shapefiles for this region here: http://download.geofabrik.de/europe/france/aquitaine.html) or, once the grid (and atlas maps) are created, project the QGIS map view at 'WGS 84 / Pseudo Mercator' again as shown below. Note how, once re-projected, the grid (and any atlas maps) will be 'bent' to match the map view projection.

10 km grid reprojected for WGS 84 / Pseudo Mercator

Want to know more about QGIS?

FSC offers a range of training courses in QGIS that provide a holistic and practical approach to using these tools for biological recording.  More details on upcoming QGIS courses, along with courses to improve your surveying, mapping and recording skills, can be found on the FSC website