an introduction to geographic information systems (gis...

72
An Introduction to Geographic Information Systems (GIS) using Quantum GIS (QGIS) version 1.8.0 (Lisboa) by University of Toronto Map and Data Library, June 2012 [email protected] http://mdl.library.utoronto.ca The data and handout for this workshop can be downloaded from http://maps.library.utoronto.ca/cgi-bin/datainventory.pl?idnum=1388&display=full Download the file called Module_data.zip Last Update: 7/10/2012 Original Document: U:\staff\MF\courses.classes.presentations\QGIS\QGIS_1.8.0.doc Module 1 – Getting to know Quantum GIS: creating a “map” or “project file”

Upload: vuongdieu

Post on 06-Feb-2018

222 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS) using Quantum GIS (QGIS) version 1.8.0 (Lisboa)

by

University of Toronto Map and Data Library, June 2012 [email protected] http://mdl.library.utoronto.ca

The data and handout for this workshop can be downloaded from http://maps.library.utoronto.ca/cgi-bin/datainventory.pl?idnum=1388&display=full Download the file called Module_data.zip

Last Update: 7/10/2012 Original Document:

U:\staff\MF\courses.classes.presentations\QGIS\QGIS_1.8.0.doc

Module 1 – Getting to know Quantum GIS: creating a “map” or “project file”

Page 2: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

2

Objective of Module: Learn to use the basic tools in Quantum GIS, create a map project file, zoom in/out of a map, experiment with scale, label map data,

and get information from geospatial data

1) Start by downloading the datasets required for these modules from http://maps.library.utoronto.ca/datapub/workshops/Module_data.zip and save this file in the “\My Documents\” area of your computer.

2) Unzip the file by right-clicking on it and choosing 7-zip Extract Here

3) Open Quantum GIS by selecting the Quantum GIS Desktop (1.8.0) icon on the

desktop. Or from the Start menu, select Quantum GIS Lisboa, and select Quantum GIS Desktop (1.8.0)

Add shapefiles1 to QGIS by clicking the Add Vector data button . The files needed are in My Documents\qgisdata\QGIS\Module_data\Module1.

4) Click on the Browse button on in the “Add vector layer” window

1 “A vector data storage format for storing the location, shape, and attributes of geographic features. A shapefile is stored in a set of related files and contains one feature class.” From http://support.esri.com/en/knowledgebase/GISDictionary/term/shapefile

Page 3: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

3

5) Add the parks, shoreline and streets shapefiles by selecting all three *.shp (shapefiles have a .shp extension) files by shift-clicking on all files in the directory and clicking on Open.

6) Click on “Open” in the “Add vector layer” window

Page 4: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

4

7) Turn all layers off one at a time by clicking to clear the box ( ) in Layers (or Table of Contents)

8) You will see that the map features will disappear from the Data View. 9) Turn all layers on one at a time by clicking to put an “x” in the box ( )

10) Turn all layers off again, but this time by using the Layer menu and selecting

Hide All Layers

Data View Layers

Page 5: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

5

11) Turn all layers on by using the Layer menu 12) again and selecting Show All Layers

13) Zoom in by selecting the icon and click in the center of the map area a few times

14) Zoom out by selecting the icon and click a few times in the center of the map area

15) Go back to the full-extent of the map area by clicking on

16) Click hold the zoom-in tool ; draw a box around downtown Vancouver as in the image below

Page 6: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

6

17) Now change your map view to a specific scale by entering 1:15000 in the scale box located at the bottom of the screen

18) If the above step to specify a scale does not work. Go to the Settings Project Properties menu option

Click on the Coordinate Reference system (CRS) tab in the Project Properties popup window, and click on Enable ‘on the fly’ CRS transformation. Then select the Coordinate Reference System WGS 84 / EPSG:4326, click on OK

Page 7: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

7

19) Right-click the Shoreline layer under layers on left side of the screen and select Zoom to layer extent

20) You will notice that you can see the whole area of all the features, because the shoreline layer covers this entire area.

Page 8: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

8

21) Right-click on the Shoreline layer and select Properties.

22) Select the Style tab. Here you can pick the colours and outline width of the shoreline line feature. Select new colours using the Change option and increase the outline width to 1. Click on OK once you have made your selections.

23) You will notice that the colour and visibility of the shoreline on the map is now

different.

24) Click on the icon and your mouse arrow should turn into a magnifying glass.

25) As you move in the map view you will notice the coordinates of where the mouse is at the bottom right of the screen (these are called UTM coordinates, you will learn more about those later:

Page 9: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

9

26) Zoom in to downtown Vancouver again. 27) Hint:

28) Try and find the approximate north and south coordinates for where you think the Vancouver city centre is located (hint, see the above image). X(longitude)_________ West, Y(latitude)___________ North

29) Now bookmark your zoomed in area by clicking on the icon or by using the View menu and selecting New Bookmark…

30) Give your bookmark the name Downtown Vancouver, and click on OK.

31) Go back to the full-extent of the map area by clicking on

Page 10: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

10

32) Go back to your bookmark by clicking on the icon or by going to the View menu and selecting Show Bookmarks

33) To view your bookmark, select the Downtown Vancouver bookmark from the

list and click on the “Zoom to” button below, and then click on the “Close” button to go back to the map.

Page 11: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

11

34) To get descriptive information (attributes) on features in a layer, highlight the

layer in the layer list and then click on the icon. Use your cursor and click on a park on the map (i.e., the green shapes). Information about the area you just clicked on will appear. (The image below is an example result if you clicked on Stanley Park, the largest park just North of downtown Vancouver).

35) Click on the “Close” button when you have reviewed the data. Try clicking on various parks on the map to get information from the polygons.

36) Highlight the Parks layer by clicking on it in the Layers section on the left-hand side of the screen:

37) Right-click on the Parks layer and select Open attribute table

Page 12: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

12

38) In the table of attribute information that appears, notice the NAME column and the entries. Click on this column once to sort in ascending order. Click it again, to sort if descending order.

39) In the Look for box, enter the term STANLEY (in capital letters), click on Search, and turn on the Show selected only option. Only the found items will now be seen.

40) Click on the Zoom map to selected rows button. You should now see Stanley Park in the center of your map. Click on Unselect all. Click on Close. We will do more complex querying in later modules.

41) You will now use the NAME column information to label your layer on the map. 42) In your map, zoom out to the full extent of the parks layer.

Page 13: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

13

43) Labeling (method 1) Right-click on the Parks layer again, but now and select Properties. Select the Labels on the left. Select Display labels, by clicking to put an “x” in the box ( ). For the Field containing label option, select NAME from the drop down. For the Default label, erase anything in the box. Then click on OK.

44) Looking at the map, you should now see your parks labeled:

Page 14: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

14

45) Repeat the labeling process for the streets layer. (Hint, use the HBLOCK field for

the label). You will notice that the map is no longer legible. What is happening is that every road segment is being labeled rather than individually named streets.

46) Open the properties window for the streets layer again, but uncheck “display labels” and click on OK. You labels should now be gone from your map.

47) Labeling method 2. Highlight the streets layer in your table of contents. 48) Select the LayerLabeling menu option 49) In the Layer labeling settings box, click on the “Label this layer” option, select

HBLOCK in the “Field with labels” option and click on OK.

Page 15: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

15

50) Your map should now have a much better look as every road should only be labeled only once.

51) Once you have built a map lik this, it is always a good idea to save your work in a Project file. Using the FileSave Project menu option, save your map as VancouverMap.qgs (overwrite the existing file if prompted). Exit out of QGIS

using the FileExit option or by simply clicking on in the top right corner.

Page 16: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

16

Module 2 – Creating a printable map

Objective of Module: Use the layout view of QGIS to create and export a printable map complete with scale bar, legend, and north arrow

1) Open VancouverMap.qgs that you created above.

2) To start creating a printable map of downtown Vancouver in your

VancouverMap.qgs project, start with the map zoomed-in to downtown Vancouver (as we left off in Module 1).

3) Select the New Print Composer icon from this toolbar

4) Select the General tab, and under Size, pick “ANSI A” letter size paper. (Click on

if you need to zoom out.) Then click on the Add new map icon , and use the mouse to draw a rectangle where you want the map to appear on the page. (Click once on the empty page first. Then click on the top-left corner, hold down the left-mouse button and drag the shape to make the rectangle. Avoid double-clicking on the empty page.)

Page 17: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

17

5) Before we add a scale bar, let’s double check what is the default measurement used for our map. Go back to the main map window and from the Settings menu, select Project Properties…

6) A properties window popup should be displayed. Click on the General tab and make sure your Layer units are set to Meters. Enter a Project title for your map.

7) Click on OK 8) Back in the Print Composer window, add a scale bar by selecting the Scale bar

icon , and click on the map to select its location.

Page 18: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

18

9) With the scale bar selected, you will see various options in the Item Properties tab that you can adjust to create a custom scale bar.

a. Segment size: Use to indicate how many units are covered (in our case

metres) in one segment. For example, enter in 250 (m). b. Map units per bar unit: Use to transform our default units to the units we

want to have the scale bar in. For example, enter in 1000 to show the scale bar in kilometers (1000m = 1km).

c. Number of segments: Use to indicate how many divisions the scale bar should be in (from right or left of zero). For example, select 4 Right segments to have 4 segments, each 250m or 0.25km.

d. Style: Use to select a scale bar style from the drop down list. For example, select Line Ticks Middle.

e. Line width: Use to adjust the thickness of the scale bar line. For example, enter in 0.50.

f. Unit label: Use to label what the units of the scale bar are. For example, enter in km.

Page 19: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

19

The following is a zoom-in of the item window and the selected options

10) Now click once anywhere on the map to see your final scale bar. You can also

click once on the scale bar to select it, and then move it.

11) To add a North Arrow, select the Add image icon , and click on the map where you want to position the North Arrow. With the image box still selected, in the Item Properties tab, select a North Arrow from the preview options. Select the Sync with map option.

Page 20: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

20

12) To add a legend, select the Add new vect legend icon , and click on the map where you want the legend to be. You can also resize the box with your mouse.

13) With the legend selected, you will see various options in the Item Properties tab that you can adjust to create a custom legend. Change the legend Title to Vancouver.

14) To take out the fram of the Legend, click on the General Options and click off the Show Frame option (see next image for details). Note that the same option is available for the north arrow and the scale bar.

Page 21: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

21

15) You can also reorder the Legend by going to the Legend items subheading.

16) You can now click on an item and use the up ( ) and down ( ) buttons to move it in the list. Try moving the Streets item to the top of the list of legend items. Click once on the map when you are done.

Page 22: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

22

17) After adding the scale, north arrow, and legend (and changing the item order), your map should look similar to this

18) Select the Export as Image icon . Navigate to where you want to save your digital map image, starting in the directory: \My Documents\. Select an image format such as .bmp or .png and name your file (include the file extension in the name – example: Vancouver.png). Then click on Save. (note that the resolution of your map is by default 400 dpi, this can be changed under the Composition tab under the item Paper and quality)

19) You can also export to PDF format. Select the Export as PDF icon . Navigate to where you want to save your digital map, starting in the directory: \My Documents\. Name your file Vancouver.pdf). Then click on Save.

20) Navigate to where you saved your file using Windows Explorer and double-click on your newly created exported map to view it.

Page 23: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

23

Module 3 – Loading Digital Map Data (Raster2 and Vector3) and working with

datums4 and projections5 Objective: Manipulate data files to fit with one another and to get comfortable

with combining and moving around layers in the Table of Contents.

1) The road network for this module is from www.geobase.ca. It is from the National Road Network Edition 8 for British Columbia. A portion for Vancouver has been

extracted from this original file for this module.

2) Start a new project, by clicking on the New Project icon . Save your current project when prompted

3) In your new blank project (map screen), add the streets shapefile by clicking on the Add Vector Layer button located on the toolbar. The data files can be found in /My Documents/Module_data/Module3/ . Start by adding the streets.shp shapefile.

2 Data source that uses a grid (equally sized square cells arranged in rows and columns) structure to store geographic information such as longitude and latitude. 3 Coordinate-based data structure used to represent linear geographic features. 4 Parameters and control points used to accurately define the three-dimensional shape of the earth. It defines part of a geographic coordinate system. 5 Mathematical formula that transforms locations between the earth’s curved surface and a map’s flat surface. Projections cause distortions in spatial properties.

Page 24: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

24

4) Add the parks_polygon shapefile the same way. 5) Right click on the streets shapefile and select zoom to layer extent. Only the

streets layer can be seen because the parks_polygon layer is actually in a different projection.

6) You should just only the streets in the view, despite having loaded two layers.

7) Next add a raster image of Vancouver by clicking on the Add Raster Layer

button the data can be found in the /My Documents/Module_data/Module3, and the file is called tile_I_10.sid

8) This image raster dataset was downloaded from Vancouver’s open data catalogue at http://data.vancouver.ca/datacatalogue/index.htm. The image is from the 2009 Orthophoto Imagery dataset.

9) In order to view all features and the raster together, we will need to change the projection of the map to UTM Zone 10 (The image’s original projection) so the image and vector data will over lay. In the Settings menu, select Project Properties.

Page 25: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

25

10) In the Projection Properties window, click on the Coordinate Reference System (CRS) tab. Check Enable ‘on the fly’ CRS transformation. And scroll down to click on Projected Coordinate Systems.

11) Scroll down to Universal Transverse Mercator and choose NAD83/UTM zone10N

12) For more on UTM zones and to view what UTM zones look like, have a look at the following website http://tinyurl.com/canadautm

13) Click apply and OK at the bottom. 14) Right click on the image in the table of contents and click zoom to layer extent.

Page 26: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

26

15) The image will look something like this with the vector data, parks and streets behind it.

16) Select the parks and streets layers (shift click) in the layer colum (Table of Contents) and move them above the raster image. You should now see your vector layers on top of the air photo.

17) Move the layers below the image again in the table of contents.

Page 27: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

27

18) The image can also be made transparent so that vector data below it can be made visible from this position. Open the Raster Layer Properties box by double clicking on the image name in the Table of Contents. Click on the Transparency and make the Global Transparency about 50%. Click on OK.

19) The streets and parks will now show through the image.

Page 28: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

28

20) Double click on the parks layer to open the layer properties box. Select the Style tab

21) Click on the Change… option. Make the Border width 1.5 in size and then click on the Fill style and choose No Brush.

22) The map should look similar to the image below.

Page 29: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

29

23) Using the Zoom in tool, zoom into the following area.

24) Continue zooming in, until you see the pixel, similar to this view below

25) Using the measure line tool, measure the length of a pixel.

You will notice that each pixel is equivalent to 10cm. Click on Close.

Page 30: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

30

Module 4 – An Introduction to Thematic Mapping6

Objective: Learn to make a Thematic Map. Learn to link data tables together. Get comfortable with the database concepts of GIS

1) Click on the New Project button to create a new map

2) Click the Add Vector Layer button From the /My

Documents/Module_data/Module4/ folder, add the GTA_census shapefile. The census data files used in this module are from Statistics Canada: www.statscan.ca Please note that census data is available at finer detail, geographically, at the University of Toronto for all census years, but only available to the general public at the Census Subdivision and larger level. As of the 2011 census, many more detailed geography datasets are available, but most variables from previous years will not be available. See http://datalib.chass.utoronto.ca/major/major.htm#can

3) Right-click on the GTA_Census layer and select Open Attribute Table

6 A thematic map is a map which displays selected kinds of information relating to specific themes, such as soil, land-use, population density, crops, etc.

Page 31: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

31

4) You will notice that there is attribute information in this shapefile, but not really any variables that can be mapped thematically. We are looking for numbers/statistics associated to each polygon in order to map a specific theme.

5) In order to use more mappable variables, we need to join the shapefile attribute data to a database or delimited file (dbf, mdb, txt or csv).

6) Using windows explorer, navigate to My Documents/Module_data/Module4/ and drag and drop the 2006_GTA_Stats.dbf file into the Table of Contents.

7) Right-click on the 2006_GTA_Stats database in the table of contents and select Open Attribute Table

8) You will notice that we have mappable fields (population being one of them) present in the table. We also have similar fields to our shapefile, one in particular being the NAME field. We will use this NAME field to join the attribute information to the GTA_census shapefile.

Page 32: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

32

9) Close the database file by clicking on Close 10) To join these two datasets, start by double-clicking on the GTA_census

shapefile or right-click on the layer and select properties. 11) Select the Joins tab. If you don’t see this tab, click on the right arrow to see more

options. Click on the Plus Symbol. In the Add vector join pop up box, select 2006_GTA_Stats for the join layer (our DBF file). Select NAME for the Join field and CSDNAME for the Target field.

12) Click on OK to the pop up box, and again to the Layer Properties box

13) View the attribute table again for the GTA_census shapefile. You will notice that

there are now 19 columns of attributes. Close the attribute window.

Page 33: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

33

14) Double click on the shapefile, GTA_join, to open up the Layer Properties box. Click on the Style tab and change Single Symbol to Graduated Symbol.

Legend Type Graduated Column 2006_Pop Mode Quantile Number of Classes 5 Click Classify and then click on OK

15) Your map should look something like this

Page 34: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

34

Module 5 – Manipulating GIS datasets

Objective: Use Structured Query Language (SQL) statements to Query and create new data from attributes associated to GIS layers.

1) In this project we are going to create a population density map. To accomplish

this task, we need to be able to calculate land area and population density. We will be using Structured Query Language (SQL) statements to manipulate our data.

2) Start a new project by clicking on the New Project icon. You can discard the previous project.

3) Add the GTA_utm.shp shapefile from the in /My Documents/Module_data/Module5 to the project by clicking the Add Vector Layer button.

4) To view the attributes click the Open Attribute Table button in the toolbar

5) We now want to edit the shapefile’s attribute table.

6) Click the Toggle Editing mode button to start editing.

7) Next click the New Column button to add a new field.

8) Add a field named area so that density can be calculated and a column holding these values kept.

Page 35: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

35

9) Fill out the new column dialogue box as shown

10) Click on the Open Field Calculator button to calculate the area of each polygon in the shapefile.

11) In the Field Calculator dialogue box click the check box next to Update existing fields. Beside that scroll down and choose the new field called Area. This is the column to be updated. Under fields scroll down and click on Area. Under Operators click area (you will notice that the box called Field calculator expression is now automatically populated with $area) and then click on OK.

12) The column will now have values equal to the area of each polygon. Note, if the values do not show up automatically, click on the Area column.

Page 36: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

36

13) Your Area field should now contain values 14) Now do the same as above to add a column called density.

Density is calculated as people per square kilometres. Calculate the density by using the formula TOTAL / Area * 1000000. Total is the Population numbers for each area.

15) To view the population density click on the Density column to sort it. It should

look something like this.

Page 37: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

37

16) To stop editing click the Edit Toggle button . Then click save to save your changes to the shapefile

17) Now we will symbolize the data to see the population density visually. 18) Double click on GTA_utm shapefile in the layers. Select the Style tab. Then

select the Graduated symbols. Select Density in the Column option, Select 5 Classes, and Quantile as a Mode. Click on OK.

19) Your map should look similar to this

Page 38: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

38

Module 6 - Creating your own geographic data Objective: Learn to manipulate simple datasets that can be mapped out.

1) Using Windows explorer, navigate to: My

Documents/Module_data/Module6/census

2) Open the text file census.txt by double-clicking on it.

3) Add the following three lines at the bottom of the file (exactly as you see them):

Yukon Territory,28674,14445,14235 Northwest Territories,37360,19115,18245 Nunavut,26745,13840,12910

The source for this data is the Census of Canada, 2001 (www.estat.ca)

4) Once you have typed the information for the territories, exit and save the file as

census.csv to your project folder (NOTE: Make sure you are saving the data as a text file and not anything else such as a Microsoft Word document if using Word as your editor).

5) We now want to joing this dataset to a shapefile of these Canadian provinces

and territories. 6) In Quantum GIS, create a new project by clicking on . 7) Add the My Documents/Module_data/Module6/provinces.shp layer by

clicking on the Add Vector Layer button.

The Province layer was acquired off of as a downloadable 1:7,500,000 base map from Statistics Canada: www.statcan.gc.ca. The layer was downloaded as a .shp file from the 2006 Census geographic boundary files.

Page 39: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

39

8) Open the attribute table for the shapefile by clicking on . Examine the fields. You will notice that the PRENAME field is the best match for our join. Close the Attribute table.

9) There are a few different methods to join these attributes to our shapefile. You can convert your csv file into DBF format, etc. In our scenario, we will install a plugin that will allow us to join the shapefile to the text file directly.

10) Under the Plugins menu, select Manage Plugins…

11) In the QGIS Plugin Manager Box filter, type mmqgis (for further information on this plugin see http://michaelminn.com/linux/mmqgis/)

12) The plugin should appear in the white box if it is installed. If it is not installed, the box will remain white as above.

13) Click on Cancel 14) Under the Plugins menu, now select Fetch Python Plugins…

15) Click on the Repositories Tab and then Click on the Add 3rd party repositories

Page 40: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

40

16) You should now see several new repositories listed.

17) Click the Plugins tab and in the filter box, type mmqgis. Select the mmqgis plugin in the list (there should only be one) and then click on Install plugin.

Page 41: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

41

18) Once the plugin is installed, click on OK to the pop up window and then Close in

the Plugin Installer window. 19) Open the plugin using the following the Plugins menu mmqgis Transfer Attributes Join from CSV File

Page 42: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

42

20) Select your census.csv file as your Input CSV File i)CSV file Field: Province ii) Join Layer: provinces iii) Join Layer Attribute: PRNAME iv) Output shapefile: Provinces_joined.shp v) Click on OK

21) Double-click on your new Provinces_joined.shp layer. Click on the Style tab, select Graduated. Unfortunately you will notice that the software will not allow you to select any fields under the Column option. (for a refresher on how to do this, see Module 4.)

22) Select the Fields tab. You will notice that the numeric fields have actually been transferred as String fields.

23) We will have to convert these to numeric fields. We could create new fields and populate them using SQL statements, but instead, we will use the mmqgis plugin to create a new shapefile with numeric values.

24) Close the Layer Properties window

Page 43: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

43

25) Using the Plugins menu, select mmqgisModifyText to Float

26) In the Text to Float pop up window, select the Provinces_joined.shp shapefile as your Source Layer and highlight the population, malepop, and femalepop fields. Save your shapefile as Provinces_numeric.shp and click on lick on OK

27) Once your new shapefile has been generated, double-click on it and click on the Fields tab. Your population, malepop, and femalepop fields should now be listed at Real type fields.

Page 44: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

44

28) Click on the Style tab in the Layer

Properties popup window. Select Graduated; Column = populatio; classes = 11; Mode = Equal Interval

29) Using the Labeling button under the Layer menu, label your map with the populatio field

30) Go to the Label Settings tab and check off the Label This Layer box, choose Population in the Field With Labels drop down box and click OK.

Adding X,Y Location Points 31) Using the File menu select Open project. Navigate to and select the map My

Documents/Module_data/ Module6. Click on Discard in the popup window. This map is composed of two shapefiles:

The Ontario shapefile was created from the Statistics Canada Canada shapefile used in the previous section.

The Algonquin Park ESRI shapefile was downloaded from the Ontario Basic Mapping (OBM) website that can be accessed through the Geography Network Canada (geographynetwork.ca). For first-time users, you will have to register online to save files from OBM. This data has already been downloaded for this project.

Page 45: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

45

32) Go to the Algonquin Park bookmark located under View and Show Bookmarks. 33) Navigate to the /My Documents/Module_data/Module6/ area and double-click

on the gpspoints.txt file. This file was generated from my Global Positioning System (GPS) unit. You will noticed that there is a column for longitude (x) and a column for latitude (y). This information can be used to create points on our map.

Page 46: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

46

34) Click on the Add Delimited Text Layer Plugin . Add the text file: My Documents/Module_data/ Module6/gpspoints.txt Click on Selected Delimiters and use a comma as the delimeter. Make sure the X field is set to longitude and the Y field is set to latitude

Page 47: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

47

35) The Coordinate Reference System Selector box should pop up. Select NAD83 EPSG:4269 and click on OK.

36) You will notice a new point layer on your map 37) Open this file’s attribute table by right-clicking on it and selecting Open Attribute

Table. 38) All your points are now listed in a database form. Close the table. 39) Double click on the gpspoints layer and go to the Style tab. 40) Click on Change… and select a triangle. Select a Fill Color (select red) and click

on OK and OK again in the Layer Properties window.

Page 48: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

48

41) The map should now look something this:

42) Using the information tool , click on the point inside Algonquin Park. 43) Add the layer My Documents/Module_data/ Module6/lakes.shp.

A layer containing lake information that covers the Algonquin Park area can be compiled of several hydrography layers found on Geobase.ca under the National Hydro Network (NHN) page.

For this exercise, the layer that will be used containing lake information has been downloaded off of the Geogratis website. A word search for NTDB (National Topographic Data Base) brought up the desired NTDB webpage. Proceed to the FTP download directory and select the 1: 250,000 shapefile for the project area (031E).

Page 49: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

49

44) Using the lakes shapefile, can you find the name of the nearest lake to this point? Lake Name:

Module 7 – creating your own polygon shapefile from Orthophotography Objective: learn to use the Edit functions of a GIS to create new georeferenced layers

1) The images for this exercise were downloaded from here:

http://data.vancouver.ca/datacatalogue/index.htm

2) Open the qps file, vancouver.qps from the Module 7 folder.

Page 50: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

50

3) Using the Pan Map button, drag the map until you see BC Place as shown below.

4) To create a new shapefile layer, go to Layer, New and New Shapefile Layer.

5) In the New Vector Layer dialogue box choose Polygon for layer type.

6) Then click Specify CRS to choose the projection.

Page 51: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

51

7) Click on Projected Coordinate System and scroll down to choose UTM

8) Now choose Nad83/UTM zone 10N and then click OK at the bottom

Page 52: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

52

9) Give the name building to the New Attribute and leave the default to Text data and width 80. Click the Add to attributes list.

10) A dialogue box will pop up to save the shapefile. Name the shapefile buildings.shp

11) The new layer will appear automatically in the Table of Contents

12) To add polygons click the Toggle Editing button in the toolbar

13) Or you can right click on the buildings shapefile and do the same thing.

14) Using the Pan Map tool , find the BC Place Stadium Building.

Page 53: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

53

15) Click the Add Feature button to start digitizing 16) Start creating a polygon for the building as below. Your polygon should start

looking

17) Once you finish drawing your polygon, right click on your last point to end the polygon.

18) The Attributes dialogue pop up box should appear. Type in BC Place in the building text box, and click OK.

Page 54: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

54

19) Complete a few more buildings. Once finished editing, click on the Toggle Editing button again to stop editing. Click save when prompted.

20) Now let’s make the polygon with a thicker outline and no colour inside. 21) Double click on the layer name in the table of contents 22) In the Layer Properties window select the Style Tab and click on Change…

option

Page 55: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

55

23) Under Fill style, select No Brush and in the Border width box, type in 2.0 as in the example below

88) Your map should now look similar to this.

89) Click the information button.

90) Now click the polygon to get the attribute information.

Page 56: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

56

91) You can see the name is BC Place. 92) You can also now label your features

using this attribute information

Module 8 – Georeferencing Raster Images of Scanned maps Objective: learn the principles of georeferencing

1) In QGIS, open the project \My

Documents\arcdata\Toronto\georef_mod8.qgs

2) Make sure that the georeferencing extension is on by right-clicking in the task bar area and selecting Georeferencing

3) In the filter box, enter georeferencer. Then click the box next to the Georeferencer GDAL tool. Click on OK

Page 57: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

57

4) Go to the Raster menu and select the Georeferencer plugin as shown below.

You can also click on the Georeferencer icon to select the plugin

5) A Reference points Window should pop up

6) Add the raster image to the Reference Points window by clicking the Add Raster button

7) Select the image /My Documents/Module_data/Module8/004.jpg to be georeferenced.

8) The Coordinate Reference System Selector window should pop up. 9) If you examine the bottom right corner of your map, you will notice that it says

EPSG:4326. That is the current projection of your map. Simply enter 4326 in the filter and select that coordinate system.

Page 58: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

58

10) Click OK

Page 59: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

59

11) Zoom into the raster image at the top-right corner of the map using the Zoom in tool (in the georeferencer, not the main window). You should now see be near the intersection of Davenport Road and Avenue Road.

12) Click the Add Point Button. We are now going to be joining the pixels from our scanned image, to real-world coordinates in our map in order to provide our image with georeferencing information.

13) In the middle of the intersection click once. The Enter map coordinates box should appear (below). Click on From map canvas

Page 60: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

60

14) Using the maing Zoom in tool, zoom to the intersection at Davenport Road and Avenue Road. Once you have zoomed to the location desired (see below image),

maximize the Georeferencer window from the bottom left of your screen.

15) Click on From map canvas again. Now click in the middle of the intersection in the map as above.

16) The Georeferencer window and the Enter Map coordinates boxes should show up again. This time, click on OK to the Enter map coordinates box that now has values for the X: and Y: as below

Page 61: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

61

17) Continue adding points to 3 more intersections. (possibly at Bernard and

Avenue, Bedford and Elgin, and Avenue and Elgin).

18) You should end up with 4 points similar to this.

19) Once your points have been selected, click the start georeferencing button in the toolbar

20) The message box pops up, press OK

Page 62: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

62

21) Fill out the Transformation settings box as in the below example. Select an output raster location and name. Ensure that the Use 0 for transparency when needed box is checked so the null values will not show. Click on OK

22) Close the Georeferencer and save the GCP Points when prompted.

23) In your map view, zoom to the full extent of the datasets by clicking on

Page 63: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

63

24) Move the streets layer above the image and your display should look like this. 25) Zoom into the georeferenced map area.

Page 64: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

64

Module 9 – Terrain Analysis Using Digital Elevation Data Objective: Learn how to create contour shapefiles and hillshading; convert contours to Autocad and Google Earth (KML) formats. 1) We will be using an image file from Geobase.ca (already provided for this

workshop. )(The image was obtained by: a. Navigating to: http://www.geobase.ca/geobase/en/index.html b. From the Data drop-down menu in the top right corner, selecting

Digital Elevation Data. Clicking on download. Then from Option 1 – Graphical Search, clicking on the area desired in the map to select it. To download these files, you must register a login and password for this site and then login to complete the download. These files contain elevation data in each pixel. This information can then be used to generate contour lines and create 3D images of the landscape cover.

2) In QGIS, click on the New Project icon, . Click on the Add Raster Layer

icon, , and navigate to the image file downloaded (/My Documents/Module_data/Module9/092g06_0100_deme.dem)

3) Using the Identify Features tool , click in several places on the screen on the gray image. Have a look at the information that pops up. The values you are seeing are elevation heights, or Z values. You might notice a wide range of heights. These are of the Vancouver area and so the heights vary quite a bit between the lowest and highest heights. We are now going to build contours

4) Before we get started, we need to enable the Raster Terrain Analysis plugin. Refer to Module 6 for enabling this plugin, or view the document QGIS_plugins_install.docs. Remember to not only download the plugin, but you need to also enable it.

Page 65: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

65

5) To give our area some perspective, we will add a Web Mapping Service (WMS)

to our map. WMSs are useful when you want to view an area but don’t particularly want to download any specific features for that area. The WMS is basically georeferenced data that is converted to image formats on the fly by the spatia queries of your software. The B.C. government’s WMS addresses can be found here: http://www.data.gov.bc.ca/dbc/geo/wms/index.page

6) To enable a WMS, click on the WMS icon .

7) In the Add Layer(s) from a Server pop up box, click on New.

8) In the Create a new WMS connection pop up window, give your connection the

Name BC and enter the following url in the URL box: http://openmaps.gov.bc.ca/mapserver/admin-boundaries?version=1.1.1 and click on OK.

Page 66: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

66

9) Once back in the Add Layer(s) from a Server box, select your BC WMS and click Connect.

10) In the list of layers accessible to you, select 39 TA_MUNICIPALITIES_O and click on Add, and then Close.

11) You should now see the Greater Vancouver Area municipalities mapped out in your screen view

12) To make contours out of the DEM data, select the Raster menu, then

Extraction, and Contour

Page 67: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

67

13) In the Contour box, click on Select… and give your shapefile of contours the name of contours.shp. Select 10.00 (metres) interaval for your contours intervals. Click on the Attribute name option and give the attribute name ELEVATION. Click on the Load into canvas when finished option and click on OK.

Page 68: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

68

14) Once the contours have been generated, click on OK in the Finished pop up, and then Close in the Contour window.

15) Turn off the DEM layer in your Table of Contents. Your map should look similar to this image below.

16) We will now create a relief image using the DEM data.

Page 69: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

69

17) Using the Raster menu, select Terrain analysis and then Relief

18) In the Relief pop up window, give your new relief image the name relief.tif, select Add result to project option, and click on Create automatically under the Relief colors option.

19) Click on OK

Page 70: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

70

20) You should now have an image similar to this one below

21) Zoom into a hilly area of your map and move the contours above your relief image

22) Click once on the Contours layer in your Table of contents. Using the Labeling

tool (or, LayerLabeling), label your ELEVATION field in your contour layer.

23) Click on OK. Your map should look something like this one below

Page 71: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

71

24) If you would like to export your contours to autocad format, simply right-click on

the contours layer in your table of contents and save as DXF format as below.

25) Note that at this time, the ELEVATION field of your attribute table for the contour layer does not get transferred over to your CAD file.

26) Click on OK on the Coordinate Reference System Selector box after having selected the NAD83 EPSG:4269 Projection system

27) You can also save your contour layer to Google Earth (KML) format using the same method

Page 72: An Introduction to Geographic Information Systems (GIS ...maps.library.utoronto.ca/datapub/workshops/QGIS_1.8.0.pdf · An Introduction to Geographic Information Systems (GIS) using

An Introduction to Geographic Information Systems (GIS)

© Marcel Fortin, GIS and Map Librarian, University of Toronto Libraries 2012

72

28) To do this, in the Save Vector layer as.. select Keyhole Markup Language as a Format. box provide the name contours.kml to your layer, change the CRS (projection information) using the Browse button. Select WGS84 (use the filter to easily find it) in the pop up window.

29) Turn off the Skip attribute creation and the Add saved file to map options. 30) In windows explorer, navigate to where you saved you KML file, and double-click

on it. Google Earth should open and should zoom automatically to your contours.