Introduction to GIS & Mapping: QGIS Desktop
Your task in this exercise is to determine the best place to build a mixed use facility in Hudson County, NJ.
In order to revitalize the community and take advantage of special loans, you want to build your facility in an
area with at least 1.5 times the national unemployment rate (4.4% as of August 2017, the year of our data). You
will also explore what sort of railroad transit is available in this area.
Open QGIS Desktop
This exercise has been tested with QGIS versions 3.16 and higher, though previous releases will likely work as
well.
1. Decide what folder you will use to store your map and data. We recommend using the folder where you
downloaded the workshop materials.
2. Open QGIS (Start (Windows icon)) > All Programs > QGIS > QGIS Desktop 3.X). Note: if this is the
computer’s first time opening the new version it may present window with a welcome message; click
“Let’s get started!” Now, open a new map by clicking on the Project tab in the top menu and then the
‘New’ project icon in the upper left corner of the QGIS Desktop window.
a. If you do not see this icon it may be due to what toolbars are turned on. Go to the View tab in
the top menu > Toolbars (at bottom) > and make sure the following toolbars are checked:
Attributes, Map Navigation, and Project. You can also access the panel and toolbar menu by
right clicking anywhere in the grey of the top menu.
Note: the QGIS Project file is a record of the layers that have been added to a map display, along with
the map display itself. This allows users to recover a map display including the layers in the map,
symbolization, visibility, units of measurement, and other display settings (similar to other software).
3. Click Project > ‘Save As…’ to save your project in the folder you set up. We recommend saving frequently
with any GIS software as there can be crashes when running tools.
Add a basemap
Adding a basemap is a quick and easy way to provide context to spatial data you are displaying or analyzing.
1. Look for the Web menu at the top of the screen and QuickMapServices. If you do not see it, follow the
instructions below. If it is there, continue to step 2.
1
MIT Libraries, GIS Services, Updated 1/6/2022
a. If you cannot see the QuickMapServices plugin, click ‘Plugins’ in the top menu > ‘Manage and
Install Plugins…’
b. Select ‘QuickMapServices’ from the list of plugins.
c. Click ‘Install Plugin’ > and ‘Close’ the window.
2. Click the Web tab in the top menu, and hover over the QuickMapServices Plugin until the dropdown
menu shows. Click on OSM Standard.
3. Note that the layer is served over the web so it may take some time to “draw” (you must be connected
to the internet to use this plugin). What you see depends on the scale you are working in on your map -
as you zoom in closer (see methods below) you will typically find more detailed information. Your scale
is displayed in the Standard toolbar and automatically adjusts as you zoom in and out.
4. To navigate your data you will primarily use these buttons:
From left to right, they are used to pan, pan to selection, zoom in, zoom out, and zoom to the full extent
of all visible data. Take a moment to explore these options as you will use them often. Note that the
icons may vary slightly depending on the version of QGIS that you have. You can hover over an icon to
see its name.
5. The coordinate of your mouse pointer and zoom scale are shown along the bottom right of the map:
Find and add data
As you learned, there are many sources for GIS data. We will first find transportation data for New Jersey.
1. Go to: http://njogis-newjersey.opendata.arcgis.com/datasets?t=Transportation. This shows all the open
transportation data for New Jersey. We found this site by doing an internet search for “new jersey gis
data.”
2. Search for “railroad” in the top search box. Options should drop down from the search box. View the
Passenger Rail Stations data layer by clicking on its name.
2
MIT Libraries, GIS Services, Updated 1/6/2022
3. A page opens that previews the data on a map. Click the download icon on the left side of the map.
4. A download pane opens on the left side of the screen. Click Download under Shapefile.
5. While the file downloads, click the information icon. Brief metadata is provided in the sidebar. Click the
View Full Details button to see more.
6. Return to the search box and repeat this process to locate and download Railroads Network. If you
want to explore any other data from this area, feel free to download it.
7. Move the files to your folder and unzip the files by right clicking on file and selecting 7-Zip > Extract Here
(or use the data extraction software installed on your computer).
8. Go back to QGIS. In the top menu select Layer > Add Layer > Add Vector Layer…
9. Navigate to your working folder by clicking on … to the right of the Source box.
a. Select the two shapefiles by selecting the file with the .shp extension. Hold ctrl to select multiple
files. One is called Railroads_Network and one has a long code name.
b. Click Open > Add (if a projection warning comes up, hit OK for now) > close window when done.
c. Note that even though you selected the .shp files, QGIS is using all the files that make up the
shapefile in order to place the data in the proper position on the map.
d. If the box appears for converting coordinate reference systems, click Ok and Ok again if
prompted. We will work with coordinate reference systems in GIS Level 2.
e. Right click on the layer name and select, “Zoom to layer.” Note depending on the random color
assigned to the railroad lines they may be hard to see.
f. Right click on each layer name and select Rename Layer. Rename Railroads_Network to
Railroad_Stations and the long code name to Railroad_Lines.
10. In addition to the transportation data you just downloaded, add census unemployment data to the map.
This data can be found in the folder Data\Final_Exercise. Repeat the process of adding a vector layer:
“Hudson_tracts_unemp_2017.shp”. Close the Add Vector data box and Zoom to this layer to hone in on
the project site.
The US Census divides the country into continuous polygons and aggregates census data for these polygons
before releasing the data to the public so that individual responses cannot be identified. Our data is for
census tracts, which contain between 1200 and 8000 people.
3
MIT Libraries, GIS Services, Updated 1/6/2022
11. In the Table of Contents of QGIS (where all layer names are listed) turn the layers on or off using the
checkboxes located to the left of each layer name. Leave the basemap layer unchecked for now so that
the next few steps will go more quickly (basemaps can slow down the drawing of other layers).
12. Adjust which layer draws on top by dragging layers above or below one another. Note: You will want to
end up with your rail stations and rail lines on top so they won’t be covered by census tract polygons.
Explore the attribute table
1. Right click on each layer’s name > select Open Attribute Table... This is the data associated with each
layer, and what that layer’s symbolization will be based upon.
Every point, line, or polygon file has an attribute table. Any data in the attribute table can be used for displaying
and labeling that layer as well as make queries from. You can also create new columns in the table and add data
or calculations. Note: metadata can be key to understanding attribute tables that use codes and abbreviations.
2. Leave the attribute table for the tract unemployment data open.
Can you tell what any of the column headings mean? It’s unlikely, so you will need to look at the metadata.
Open the text file (outside of QGIS) in Data\Final Exercise. You now see the definition for each column. Note:
this data was downloaded from a web based GIS, Social Explorer, and joined to a polygon file from the US
Census.
Q: Variable A17005_003 is the number of unemployed people in the civilian population. Is this what we want to
map? Why or why not?
A: Mapping raw numbers is not often useful because the total population in one census tract may be more
or less than another, and so the counts are not meaningful to compare between geometries. One way to
“normalize” data is to divide the counts by the total population to calculate a rate.
3. Click the Open Field Calculator icon
a. Note, in some versions of QGIS this may be greyed out until you click the Toggle edit icon
4. Make the Output field name Unemp_rate and make the Output field type Decimal number.
a. In some versions of QGIS, you may need to specify the field length (if these options are greyed
out, ignore this step). In this case, make Output field length 11 (number of characters) and
precision (number of decimal places) 11.
Q: Since we want to divide the number of people unemployed by the total number of people in each tract. What
columns would you use to do this, (remember you can look at metadata to know what each column is)?
A: To create the expression that will calculate the unemployment rate:
• Click in the Expression box
• Open the Fields and Values menu in the box to the right (under the search line)
• Double click on the fields to add them to the expression box (you can also type them in directly)
• Use the divide by function button between fields to create the expression shown.
4
MIT Libraries, GIS Services, Updated 1/6/2022
5. Click OK.
6. If you turned on editing, click the Save edits icon in the table’s menu
And click the Toggle edit ( ) to stop editing.
If you did not turn on editing, proceed to the next step.
Next, based on the original problem statement we know that we want to find tracts that are 1.5 times the
national unemployment rate. This is equal to .066 or greater. Click the Select features using an expression
button at the top of the table’s menu window.
7. Open the Fields and Values menu. Double click on Unemp_rate in the list. This will add it to the
expression box on the left. Finish the expression by setting it greater than or equal to .066
(“Unemp_rate” >= .066). You will find >= in the Operators menu (below the Fields and Values menu).
Click Select Features and close the Select by expression window, to see the rows that were selected.
5
MIT Libraries, GIS Services, Updated 1/6/2022
All rows that correspond to a tract with a higher than average unemployment rate are highlighted and the
corresponding tracts are highlighted on the map.
8. Without clicking anywhere within the table or map (will alter the selection), close the Attribute Table.
Export to a new file
We will now export the selected tracts to a new data layer so that we can more easily visualize which tracts have
high unemployment. Exporting a smaller area of data is the easiest way to subset a dataset to only the desired
records or keep your file sizes smaller and more manageable.
1. Right click the unemployment layer in the table of contents > Export > Save Selected Features As…
2. Make the Format ESRI Shapefile. Click the … next to the File name box and navigate to your folder.
Name the file “Unemp_ratehigh” in your folder. Keep the CRS (EPSG,4269, NAD83). Click OK.
Note: file names and locations can be very important when working on projects. GIS software tends to generate
many files, so you want to make sure to use file names that are descriptive and easy to remember.
3. Clear the selected features by clicking the “Deselect features from all layers” icon in the top menu.
4. Now try turning on/off this new layer and the original unemployment data. What do you notice?
5. Save your map document to your working folder on your local drive using the Save icon.
So far you have learned how to open and navigate the software, use plugins to add a basemap, find, download,
and add data, explore and select from the attribute table based on information in the metadata, perform a
selection, and export your new dataset. You have completed many parts of getting started in a GIS and are half
way through the exercise. Feel free to take a short break before continuing on to symbolization, decision
making, and creating and exporting your final map.
6
MIT Libraries, GIS Services, Updated 1/6/2022
Symbolize data
Change a single symbol
Rather than completely covering the unemployment polygon layer with the one for high unemployment, we can
change the symbology of the high unemployment layer so that we can still see the tracts for the entire county
underneath.
1.In the table of contents, double click the high unemployment layer (Unemp_ratehigh) name.
2.Click on the Symbology tab
3.Click on the words, “Simple fill” to bring up the options.
4.In Fill Style, change the Simple fill style to a pattern, such as Diagonal X. That way we can still see the
unemployment tract data layer underneath.
5. Adjust the color (using the drop down menu in the ‘Fill’ box) and click OK when done.
Note: Your help screen may look slightly different depending your version of QGIS.
7
MIT Libraries, GIS Services, Updated 1/6/2022
Explore data distribution
Before we make a choropleth map of the unemployment rate, we need to examine our data in order to create
the most appropriate map. A quick way to explore the distribution of our data in QGIS is to make a graph.
1. Double Click hudson_tracts_unemp_2017 in the Layers Panel.
2. Choose Symbology from the left column.
3. Select Graduated from the top dropdown menu.
4. Choose Unemp_rate as your Value/Column.
5. Select a color ramp of your choosing.
6. Click Classify to load that field’s values.
8
MIT Libraries, GIS Services, Updated 1/6/2022
7. Now select the Histogram tab (next to Classes). Click on Load values and see how the frequency of
different values are being symbolized based on the method, number of classes, & color ramp.
We see that unemployment rate is relatively low, but that there are some outliers with a high employment rate.
Make a choropleth map
1. Symbolize the data in whatever way you think is best. Map symbology can be used to alter the way
people view and understand information, just like statistics. It is important to understand what you want
to express in your map and think carefully about how best to symbolize your data. Note: you can click
apply when finished instead of OK to test options, without leaving the Layer Properties window.
a. Pick a color ramp from the drop down menu.
b. Choose the mode and number of classes (options below the classes box)
c. Here is brief information about some of the available classification methods. For a more in
depth analysis check out our mini-tutorial on choropleth mapping.
i. Equal Interval: classes are all the same size.
ii. Quantile - number of values in each class is the same. If there are 100 values and we
want 4 classes, quantile method will make it such that each class will have 25 values.
iii. Natural Breaks (Jenks) – algorithm finds natural groupings of data to create classes. It
maximizes the variance between individual classes and min. variance within each class.
iv. Standard Deviation - creates classes based on standard deviations from the mean.
v. Pretty Breaks - This is based on the statistical package R’s pretty algorithm. It is a bit
complex, but the pretty in the name means it creates classes with round numbers.
d. To reduce the number of decimals shown in the legend, use the Precision options in the upper
right part of the Symbology window.
2. Click Ok when you are finished.
3. Save your map document.
Do you have an idea about where you might build based on the unemployment rate?
Obviously many factors go into selecting a building site. We will examine one more: train access.
Find tracts that have railroad stations
You will use the Spatial Query tool to select all tracts that contain a railroad station.
1. From the top menu, click Vector > Research Tools > Select by Location.
2. Select features from the hudson_tracts_unemp_2017 data layer, where the features “contain” features
from the Railroad_Stations_in_NJ.
3. Click Run > then Close.
9
MIT Libraries, GIS Services, Updated 1/6/2022
Now all tracts that contain a railroad station are highlighted. Based where there is high unemployment (1.5
times the national unemployment rate, use ‘Unemp_ratehigh’ layer) and access to transportation, where might
you want to build?
Remember you can repeat the process of exporting your selection to its own layer, which you can symbolize in
such a way (e.g. hollow with dots) that it can be seen alongside other layers. You may also want to turn off
railroad lines and stations once you have performed the prior steps.
Once you have finished this step, clear the selection.
Choose a tract for building
1. Click the selection button at the top of the screen and click on the tract that you want to build in, based
on the visualization you have made. You can select more than one tract by holding down the Ctrl button.
2. Save the selected feature(s) using the same method you used above so that you know which location(s)
you selected to build on.
3. Clear the selection once you have exported the layer.
4. Wondering what area was actually chosen for this building? Add Bay_street_building from
Data\Final_Exercise. You may need to double click on the point symbol and adjust the size to see it.
Read the article here.
10
MIT Libraries, GIS Services, Updated 1/6/2022
5. Make final changes to the color of any of the data layers.
Layout and export your map
1. In QGIS, you can create a map to export and print in the Map Layout.
a. On the main toolbar menu at the top of QGIS click Project > Layout Manager.
b. In the Layout manager window, click Create… and name your new layout something like “New
Jersey Building Tract”.
c. Click OK.
2. A new window will open where you can work on the layout your map. If you close the new layout, you
can re-open it by clicking Project > Layouts, and choosing your layout from the list.
The menus on the left of the layout window are tools that help you move around and add things to your
map. The menus across the top are tools that allow you to save and export, zoom in and out and more.
Hover over the symbols to read what they do.
3. On the left-hand menu, click on the Add Map icon.
4. Click and drag a box on the blank page. Your map will appear in the box you’ve drawn. You can click and
drag the map around and resize it to make the margins work the way you want.
5. Use the select/move item icon to select and move your map around on the page.
6. Use the move item content icon to adjust the placement of your map.
7. Right click the map itself > Page Properties to test switching between portrait or landscape orientation.
11
MIT Libraries, GIS Services, Updated 1/6/2022
8. Use the Add Label button and click on the page to add a title box.
9. On the right side of the Layout window, click on the Item properties tab and type your title in the Main
Properties box. Change font (click right dropdown arrow), margins, position, size and background the
way you think it should be.
10. Insert a legend using the Insert legend button, then click and drag a box for the legend placement. Use
the Item properties tab to modify your legend.
11. Insert a scale bar and/or North arrow (click once to start line, again to end it, & right click to finish).
Note these are the least important features you need to add so do not pick distracting formats.
12. Use again the Add New Label icon to create a text box for your name, date, and sources for your data. If
you do not like the default settings for any item, use the item properties to edit its display.
13. Save your layout.
Export your map
1. In the top menu go to Layout > and look at the different export options:
Export as Image, Export as SVG…, Export as PDF… You can also use the icons to save your map in any of
these ways. Note: if you save as a JPEG or TIFF, you can adjust the resolution of the file.
If you receive a “Project Contains WMS Layers” warning, this means that the owner of the basemap
won’t allow large areas to be exported. Our area is small enough to ignore this warning so feel free to
have your basemap on when exporting (you can move layout view to the side to edit what layers are on
in original data view window).
2. Save your exported map.
3. Click close (if needed after export).
4. Open your map to see what it looks like.
5. Close the Layout window & then the Layout Manager window
Save your QGIS document
1. Click the Save icon.
Note that when you save a QGIS document, you are only saving the links to the layers in your project and how
you have symbolized them, not the actual datasets. If you move your project to a new location, you will need to
12
MIT Libraries, GIS Services, Updated 1/6/2022
move all the files linked to your project. Note: also keep in mind that each shapefile has multiple files associated
with it, and they need to stay together to work properly.
By default, QGIS stores the full path name to each layer in the QGIS document. This means that if you move your
files around, your path name will change and you will need to redirect QGIS to the new file location for each
folder of data. If you will be moving files around, it is recommended that you save a relative path to the data
files in your project. QGIS does this by default.
2. To be sure the default is set that way, go to Project > Properties.
3. Click on the General tab.
4. Check that the dropdown menu next to Save paths is set to relative, not absolute. Click OK to close the
window.
Congratulations!
1. You should now be familiar with the following:
2. Opening a QGIS Desktop Project
3. Adding basemaps & data
4. Exploring attribute tables
5. Selecting & exporting data
6. Symbolizing data
7. Performing selections & analyses
8. Exporting & Saving a map
For more information, check out the QGIS Documentation.
13
MIT Libraries, GIS Services, Updated 1/6/2022
MIT OpenCourseWare
https://ocw.mit.edu
RES.STR-001 Geographic Information System (GIS) Tutorial
IAP 2022
For information about citing these materials or our Terms of Use, visit:
https://ocw.mit.edu/terms
14
MIT Libraries, GIS Services, Updated 1/6/2022