QGIS Introduction Exercise: Zombie Apocalypse
This exercise is designed to instruct you in using QGIS – an open-source GIS software platform which is gaining popularity in the professional world.
In this exercise you will learn how to:
- Download GIS source files
- Perform basic functions within QGIS
- Create and edit shapefiles and their attributes
- Clip layer attributes using other layers
- Install and use QGIS plugins
- Import Google Maps imagery
- Create a home area buffer map for use in case of a zombie apocalypse
Some helpful introductory materials for QGIS:
The official QGIS Training Manual:
QGIS – For Absolute Beginners:
Introduction to QGIS:
Data management:
In this exercise as in any exercise, data management is crucial to your success. Before starting this exercise create a folder in your named folder on the D: drive titled “QGIS Zombie Lab”. This is where you will be storing the data for this lab.
Data files needed in this lab exercise can be obtained from the Maine Office of GIS at They are as follows:
- County Boundaries
- Town Boundaries
- Cemeteries
Click the green icon for shapefiles (see legend at top of webpage) and your download will start. Once the files have finished downloading, extract them using PeaZip to separate folders titled “Cemeteries”, “Maine Counties”, and “Maine Towns” within your “QGIS Zombie Lab” folder on the D: drive.
Starting the Exercise:
Now the fun begins – we can open QGIS!
- Upon opening QGIS, you may be greeted by “recent project” files on the working area (formally called the canvas). Don’t touch these! They are other student’s work.
- On the left hand side of the page is the browser panel. This is where all of your files can be accessed within QGIS.
- Within the file directory in the browser panel, navigate to your folders in the QGIS Zombie Lab folder you created earlier. Clicking the small [+] symbol next to each folder will show you its contents.
- Within each of your subfolders in the Zombie Lab folder, you will see .shp files. Right click on “county.shp” under the Maine Counties folder and select “Add Layer”. You should see the shape of Maine appear on your canvas with the counties outlined.
- In a similar manner as above, add “Metwp24P_Dissolve.shp” within your Maine Towns folder as a layer too.You should see all of the towns in Maine appear over the counties.
- Turn off the visibility of the Towns layer by clicking the black [X] next to that layer in the Layers Panel, found beneath the browser panel.
Editing Layers and Shapefiles:
Because you’re a student at UMaine, during the school year you live in Penobscot County. We’ll be focusing on that county for the remainder of the lab, so let’s edit the “county” layer to include just Penobscot county.
- Right-click the county layer in the Layers Panel and select “Open Attribute Table” from the dropdown. You should see a new window open with every feature in the county layer listed in it.
- At the top of the table window, click “Select/filter features using form” or simply use the keyboard command Ctrl+F. This is a filtering feature which allows us to select specific parts of a layer based on the attribute data associated with each feature.
- In the “COUNTY” text field type “Penobscot”.
- Next to the “COUNTY” field, leave the case-sensitive checkbox unchecked and click the button next to it. In the dropdown, select “Not equal to”.
- At the bottom of the window, click the “Select features” button and close the table window. You will notice all of the counties are highlighted other than Penobscot county.
- At the top of the window in one of the toolbars, you’ll notice a button that looks like a yellow pencil. This is the “toggle editing” button. Click it, and you’ll notice the outline of each feature you selected in the previous step is outlined in red.
- Hit the delete key on your keyboard. You’ll notice all of the features other than Penobscot County have been deleted from the layer.
- Now is a good time to save both the layer and your project. To save the layer, right-click the layer in the Layer panel and select “Save as” from the dropdown menu. In the resulting dialog box, choose ESRI Shapefile (option found in the Format dropdown list)and browse to your Maine Counties folder and name the file “Penobscot”. Click OK to save the pathname and then click OK in the dialog box to save the file.
To save your project, follow this path from the toolbar at the top of the window: Project>Save as… In the resulting dialog box, name your file with your first two initials followed by “Zombie 1a”. Ex: “JS Zombie 1a”.
- You’ll notice the Penobscot layer has appeared in your layers panel. You can remove the “county” layer now by right-clicking it and selecting “Remove”. A dialog box will open asking if you wish to save it. Select No (you don’t want to edit the original county file with your changes). Another dialog box will ask if you wish to remove 1 legend entry. Click OK.
Clipping Features with Features from other Layers
Now that we have just the Penobscot layer, we need to cut the Town layer with the Penobscot layer as a template in order to obtain just the towns within Penobscot County.
- Move the Penobscot Layer above the Town layer by clicking and holding the Penobscot layer in the Layers panel and moving it above the Town layer in the tree.
- Turn on the visibility of the Town layer. You should notice the Penobscot layer is visible over the Township layer.
- Select the Town layer by clicking it once in the Layers Panel. Make it editable.
- Follow this path from the toolbar at the top of the window: Vector>Geoprocessing Tools>Clip.
- In the dialog box, select your input layer as “Metwp24P_Dissolve” and your clip layer as “Penobscot”. Select Run at the bottom of the window.
- You will now have a layer named “Clipped” in your Layers Panel. Save it as “Towns” in your Maine Towns folder. An error box will appear – simply hit OK.
- Remove the “Metwp24P_Dissolve”, “Clipped”, and “Penobscot” layers from your Layer panel and add the Towns.shp file as a layer.
- Add “cemeteries.shp” as a layer from your Cemeteries folder.
- Make the cemeteries layer editable.
- Follow this path from the toolbar at the top of the window: Vector>Geoprocessing Tools>Clip
- In the dialog box, select your input layer as “cemeteries” and your clip layer as “Towns”.
- Save the new “Clipped” layer as “Active sites” in your Cemeteries folder and remove the clipped and cemeteries layers from your Layer panel.
Importing Google Imagery
- Utilizing the OpenLayers plugin (path: Web>OpenLayers plugin) open Google Hybrid. If you do not have this plugin, go to the Plugins tab in the toolbar at the top of the window. Click “Manage and Install Plugins…” and then search for “OpenLayers Plugin”. Install it, and you’ll be able to use it.
- The Google Hybrid Layer should appear on top of all of your layers. If it isn’t, drag it to the top of the tree.
Creating a Shapefile layer and Adding Features
- On the left hand side of the screen, click the “New Shapefile Layer” button.
- In the resulting dialog box, select the “Select CRS” button next to the project dropdown. In the Filter textbox, type “NAD83 UTM Zone 19N” and select NAD83/UTM Zone 19N from the options displayed.
- Back in the dialog box you can now select UTM Zone 19N from the projection list. Do so now.
- In the New Field area, input “Location” into the Name textbox. Set the type as Text Data and set the length to 10. Click Add to Fields List.
- Select the “id” field and click “Remove Field”.
- Click OK and save the shapefile layer as “Home” in your Zombie Lab folder on the D: drive.
- Turn off the Active Sites and Towns layers and make the Home layer editable.
- Zoom to where your Maine address is using the zoom tool .
- Add a point in the center of your home building by using the Add Feature button. A dialog box will open, type “Home” and click OK.
- Make your Home layer un-editable. The program will ask if you wish to save changes. Accept.
- Select your Home point using the Select Features tool .
Adding Buffers around Points
Now that we have your home location entered as a point on the map, we can create several buffers around it for threat levels of zombies based on proximity to your home. Let’s do that.
- Follow this path to get to the buffer tool: Vector>Geoprocessing tools>Fixed distance buffer.
- Select the input layer as Home and set the distance to 3218. This setting is in meters, so this is approximately two miles. Set the segment number to 50, and click Run.
- Save this buffer layer as “Low Threat” in your Zombie Lab folder, as this is the largest buffer distance you’ll have on your map.
- Repeat steps 1 & 2 using a distance of 1609 (approximately 1 mile). Save this layer as “Medium Threat” in your Zombie Lab folder.
- Repeat Steps 1 & 2 using a distance of 805 (approximately 0.5 mile). Save this layer as “High Threat” in your Zombie Lab folder.
- Remove all layers called “Buffer” from your Layers panel.
- Adjust the colors of your buffers to match the image in Step 8 by right clicking each layer, clicking properties, navigating to Style in the dialog box, changing the Fill color, then clicking OK. Example dialog box below.
- Make each layer semi-transparent by right clicking on the layer, selecting properties, selecting Style, and moving the transparency slider to 75%. Click OK.
- Move the Home layer to the top of the tree, with Active Sites directly below it.
The Final Steps: Creating Layouts
- You may wish to change the properties and appearance of your features for your layouts. Explore changing appearances if you wish, but it is not required (though it may boost your grade if you explore new things not outlined in this lab exercise).
- To create layouts in QGIS, one must click the “New Printer Composer” button . After clicking, a Composer Title dialog box will pop up. Name your layout whatever you want (ex. Zombie Output).
- All of the tools necessary to create a proper map (legend, map, north arrow, etc) can all be found in the tool bar on the left of the composer window.