New to QGIS? Want to learn a few basic techniques? Follow along in the making of this Lisa Frank-esque map to see how it’s done.
Download QGIS if you don’t have it already. Right now we’re on version 3.2, which is what I recommend to download. If you see anything different between that and what I’m showing here let me know, I’ve got 3.3 running for this (via the osgeo network installer, where you can get the very latest development version). If you have an older version of QGIS already running you can probably use it but never fear, you can install multiple versions on the same machine and they’ll run just fine.
Use Natural Earth data for this project. I’ll provide the links to the appropriate datasets as we go. Unfamiliar with Natural Earth? This is the dataset to use when designing maps from world-scale to admin 1 (state)-scale. Note that depending on where you reside and your world-view country and state boundaries could be argued differently. It doesn’t matter what dataset you use, always scrutinize it for accuracy and usefulness for your purpose.
Add the GRAY_LR_SR_OB raster dataset from Natural Earth to an empty QGIS project. Look for the one titled “Gray Earth with shaded relief, hypsography, and ocean bottom, medium-sized.” When you download the data file you’ll see it is made up of several files. Just drag and drop the large TIF file onto the QGIS project to add it.
After adding it you see it’s a basic gray hillshade, which is pretty nice as-is. Change the projection to something more suitable for the continental U.S. such as EPSG: 102003. Find the button to do this at the bottom right corner of the QGIS window. Click it and the CRS tab from Project Properties appears, where you can type the code into the filter, select the projection, and click OK.
Now the map will look like this:
But for this project we want it to be purple with some other modifications. Open the Layer Styling Panel by right-clicking in the toolbar area at the top of the QGIS project and selecting Layer Styling Panel. It will appear on the right side of the project window. This is where you do most of the styling for each layer you add to the project. It auto-updates as you go and keeps a history of edits so that you can return to a previous design state if you desire. In this panel, make the following changes to the hillshade layer:
The purple color used here is #e19aeb, which you put in the HTML Notation box after clicking on the color drop-down and clicking Choose Color. This kind of color code is also called HEX. You also need to change the opacity of this hillshade so it is even lighter. We don’t want it to overwhelm the unicorns, after all. Use the Transparency tab in the Layer Styling Panel for that, like this:
The map should now look like this:
Now add ne_10m_admin_0_countries_lakes to the project.
(If you’d prefer adding in this vector layer and the next 3 as a single geopackage that contains all the Natural Earth data, which is recommended if you’ll be doing some experimenting as this way you’ll have more data, use the Natural Earth Starter Kit geopackage, which you also drag-drop onto the QGIS project window and select data from the dialog that pops up.)
This countries layer will mask the U.S. so the unicorns will show up better. Use the Query Builder to filter the data by right-clicking the countries layer, going to the Source tab, and clicking the Query Builder button, entering in the filter “NAME” = ‘United States of America’, which will then appear as shown:
Using the Layer Styling panel with the countries layer active in the Layers list, change the fill color to white and the opacity to 70%. The map will now look like this:
Now we do much the same thing with the ne_10m_ocean layer, except that we use a dark gray border line and only a 60% opacity, with no filter. The project will then look like this:
Next, add the ne_10m_admin_1_states_provinces_lakes file to the project and change the Fill style to No Brush and set the Stroke color to #6f4486. Now we’ve got:
We can’t forget to put in some color for the Great Lakes. To do this, add the ne_10m_lakes layer and style it with a blue fill color so that it looks something like this:
Duplicate the ne_10m_admin_1_states_provinces_lakes file via right-click as shown:
Rename the new duplicated layer to something like “states” (right-click, Rename Layer) and move it to the top of the layer list (drag). Right-click this layer again and choose Open Attribute Table. Click the Toggle editing mode button, which looks like a pencil, then click the New Field button and add a new integer field called rainbow. These buttons and the new field settings are shown here:
Click OK and now you have a new field added to the data table. We’ll use this field in a bit. Click the edit button again to save the changes.
The unicorn icon is from The Noun Project, where I paid a couple of bucks for a royalty-free version. When you get an SVG icon for use in QGIS from somewhere other than QGIS’s built-in set of icons, you’ll notice that you can’t change their color. But for this map we definitely want to have unicorns of different colors. So we have to modify the SVG file. If you want to skip this step, simply choose an icon from the set that comes with QGIS. Otherwise, download an icon that you want and then open up the SVG file in a text editor and add the following bit of code at the beginning of the path tag (note that if there are multiple paths in the file you need this code in every path tag).
fill=”param(fill) #FFF” stroke=”param(outline) #000″
The file will look something like this:
This is just a snippet, of course, the file is much longer.
Now that the SVG file has parameters for the fill and stroke in it, save it. To add it to the project, first what we’ll do is simply add it in the same style for all the states by using a centroid fill, SVG marker in the styling settings. Make sure the drop-down in Layer Styling is set to Single symbol, click on the Simple fill box (yours will have a different color as it just chooses a color at random):
Once you’ve clicked Simple fill you’ll see that there is a drop-down next to Symbol layer type. You can change this drop-down to Centroid fill. Notice the map now has a centroid dot for every state. We want to use our icon instead of these dots so now click where it says Simple marker and change the new drop-down that says Symbol layer type to SVG marker. The dot turns into a question mark. It’ll look like this:
Load your icon by using the ellipsis button at the bottom of the Layer Styling panel and browsing for it.
Right now the map has a whole lot of symbols.
Select the Centroid fill part of the symbol and un-check the box next to Draw point on every part of multi-part features. That should de-clutter the map.
Zoom in to the western continental U.S. and use the selection tool to select some of the western state icons.
Right-click to open the attribute table for this layer again and, again, click the edit pencil button to toggle editing to on. In the drop-down field menu that appears, select the new field called rainbow and put a “1” in the box. Then click Update Selected. This assigns a “1” in the rainbow field for the points that we just selected. Go ahead and check the data to see that it happened.
Go back to the map, select some more icons, and update the rainbow field to “2.” Continue like this until you have some icons set to 1, 2, 3, 4, and 5. Each of these numbers represents a different color. Toggle the editing button again to save the edits.
When that’s done, go back to the Layer Styling panel for the layer and change the renderer from Simple fill to Rule-based. It should have one rule already:
… if you double-click it you’ll see that the rule has a Centroid fill and SVG marker setting with the custom icon.
Put “1” for the Label, put “rainbow” = 1 for the Filter, and change the color to red. Then use the back arrow to go back to where the rules are listed (we only have this one at the moment).
Now we simply copy and paste this rule until there are five rules. On windows just use ctrl-c and ctrl-v or right-click the rule. Change their colors, labels, and filters so that it looks like this:
Here’s how the project looks now that this is done:
This map was just for fun. Please note that the finished map at the top of the page was further modified in Inkscape, where I created an ellipse and used it as a clipping object, then created a new ellipse of the same size as an outline object set with a drop-shadow filter.
While this was a fairly meaningless map in the sense that it has no real-world thematic meaning, I hope it served the purpose of adding some fun to a beginning learning experience.
If you’d like to learn more advanced map techniques with real-world examples, please keep an eye out for QGIS 3 Map Design, written by Anita Graser and myself, due on bookshelves in November 2018. In the meantime, you can explore more QGIS “recipes” in the 1st edition of the book, QGIS Map Design. (Below is an affiliate link that helps support me. Feel free to look at other bookstores like Barnes and Noble, or, as always, ask your local library if they have it or will get it for you.)
— Gretchen Peterson (@PetersonGIS) July 24, 2018
Hi. Is there a plug in for geo-referencing vector data. I work quite a lot with CAD files which often aren’t in a coordinate system have seen vector bender in 2.18 but nothing in 3 onwards so far…
— Shubham Mishra (@NarrativesUrban) July 24, 2018
You can use v.transform from GRASS GIS and afaik one of the CAD import plugins has the option as well to set a new cord point
— Frank Broniewski (@frankbroniewski) July 25, 2018
This looks very useful: https://t.co/DOnyga0RHn
— Alberto Cairo (@albertocairo) July 24, 2018
Really hoping you have a link to a mermaid chart as a follow up, I feel a popular new series on the cards…
— Simon Beaumont (@SimonBeaumont04) July 24, 2018