Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
onlinegis [2020/10/20 14:06]
qcbs created
onlinegis [2024/04/09 12:56] (current)
qcbs [QGIS]
Line 1: Line 1:
-====== Introduction to Open Source Geographic ​information systems ​with QGIS ======+======= Introduction to Open Source Geographic ​Information Systems ​with QGIS =======
  
  
Line 6: Line 6:
 Guillaume Larocque, Research Professional. (guillaume.larocque@mcgill.ca) Guillaume Larocque, Research Professional. (guillaume.larocque@mcgill.ca)
  
-November 12 and 13, 2019McGill University+April 2024. Online
  
-===== Presentation ​===== +==== Presentation ==== 
-[[http://​prezi.com/​nuaz63vqhe50/​introduction-to-geographic-information-systems-with-qgis/​|Link to presentation on Prezi]]+[[https://​prezi.com/​uya2zwemllkt/​introduction-to-geographic-information-systems-with-qgis-online/|Link to presentation on Prezi]]
  
 ===== 1 - Installation of QGIS and GRASS ===== ===== 1 - Installation of QGIS and GRASS =====
  
-QGIS 3 and GRASS 7 will be used for this workshop. Please make sure that you have the appropriate versions installed prior to the workshop. ​+QGIS 3.36 will be used for this workshop. Please make sure that you have the appropriate versions installed prior to the workshop. The standalone installation is less complicated than the OSGeo4W Network Installer. If you only need QGIS (i.e. for this workshop), you may want to select that instead of OSGeo4W which is [[https://​www.osgeo.org/​projects/​osgeo4w/​|a set of open source geospatial software for Windows]].
  
-Install QGIS and GRASS following [[https://​qgis.org/​en/​site/​forusers/​download.html|these instructions.]]+Install QGIS following [[https://​qgis.org/​en/​site/​forusers/​download.html|these instructions.]]
  
 ===== 2 - Resources ===== ===== 2 - Resources =====
Line 24: Line 24:
 ==== QGIS ==== ==== QGIS ====
  
-  * The **[[http://​docs.qgis.org/​2.14/​en/​docs/​user_manual/​|QGIS user guide]]**. +  * **[[https://​docs.qgis.org/​3.34/​en/​docs/​user_manual/​index.html|The QGIS user guide]]**. 
-  * **[[http://manual.linfiniti.com|The QGIS Training Manual]]**. Comprehensive online guide to QGIS with detailed tutorials. A book version of this manual is [[https://​locatepress.com/​qtm|also available]] +  * **[[https://docs.qgis.org/​3.34/​en/​docs/​training_manual/​index.html|The QGIS Training Manual]]**. Comprehensive online guide to QGIS with detailed tutorials. A book version of this manual is [[https://​locatepress.com/​qtm|also available]]. 
-  * [[http://​www.qgistutorials.com/​en/​|QGIS Tutorials and Tips]]by Ujaval Gandhi. ​  +  * [[http://​www.qgistutorials.com/​en/​|QGIS Tutorials and Tips]] by Ujaval Gandhi. 
-  * **[[https://​www.packtpub.com/application-development/learning-qgis-20|Learning ​QGIS 2.0]]** Recent book on using QGIS. +  * **[[https://​www.qgis.org/en/site/​forusers/​books/​index.html|Books on QGIS]]** ​List of recent books on using QGIS. 
   * [[https://​locatepress.com/​gsd|The Geospatial Desktop]] - Book which provides an overview of different open source GIS tools, including QGIS and GRASS. This [[http://​geospatialdesktop.com/​|website]] is dedicated to the book.   * [[https://​locatepress.com/​gsd|The Geospatial Desktop]] - Book which provides an overview of different open source GIS tools, including QGIS and GRASS. This [[http://​geospatialdesktop.com/​|website]] is dedicated to the book.
   * [[https://​www.youtube.com/​user/​tutorielgeo|TutorielGeo Youtube channel]]. In French, dedicated mostly to QGIS tutorials. ​   * [[https://​www.youtube.com/​user/​tutorielgeo|TutorielGeo Youtube channel]]. In French, dedicated mostly to QGIS tutorials. ​
-  * QGIS [[http://​gis.stackexchange.com/​questions/​tagged/​qgis|Stackexchange Questions and Answers site]] +  * [[http://​gis.stackexchange.com/​questions/​tagged/​qgis|QGIS Stackexchange Questions and Answers site]]. 
-  * Subscribe to the **QGIS-User mailing list** [[http://​lists.osgeo.org/​mailman/​listinfo/​qgis-user|here]].  +  * Subscribe to the **[[http://​lists.osgeo.org/​mailman/​listinfo/​qgis-user|QGIS-User mailing list]]**
-  * [[http://​qgis.org/​planet/​|Planet QGIS - QGIS blogs aggregator.]]   +  * [[http://​qgis.org/​planet/​|Planet QGIS - QGIS blogs aggregator]] 
-  * [[http://​spatialgalaxy.net/​|spatialgalaxy.net - Exploring the Realms of GIS]] +  * [[http://​spatialgalaxy.net/​|spatialgalaxy.net - Exploring the Realms of GIS]]. 
-  * [[http://​underdark.wordpress.com/​|Free and Open Source GIS Ramblings]]+  * [[http://​underdark.wordpress.com/​|Free and Open Source GIS Ramblings]]
 + 
 +==== R and QGIS ==== 
 +  * qgisprocess R package allows you to run QGIS functions from R. https://​github.com/​paleolimbot/​qgisprocess 
 +  * QGIS R package makes it even easier to run the QGIS functions by name. https://​github.com/​JanCaha/​r_package_qgis
 ==== GRASS ===  ==== GRASS === 
  
-  * [[http://​grass.osgeo.org/​grass64/​manuals/​index.html|GRASS User manual]]+  * [[http://​grass.osgeo.org/​grass64/​manuals/​index.html|GRASS User manual]].
   * Read **Open Source GIS: A Grass Approach** [[http://​www.springerlink.com/​content/​978-0-387-35767-6#​section=190784&​page=1&​locus=0|online from Springer]].   * Read **Open Source GIS: A Grass Approach** [[http://​www.springerlink.com/​content/​978-0-387-35767-6#​section=190784&​page=1&​locus=0|online from Springer]].
-  * Subscribe to the [[http://​lists.osgeo.org/​mailman/​listinfo/​grass-user|GRASS mailing list.]]+  * Subscribe to the [[http://​lists.osgeo.org/​mailman/​listinfo/​grass-user|GRASS mailing list]].
   * Access the [[http://​grass.osgeo.org/​wiki/​Main_Page|GRASS wiki]].   * Access the [[http://​grass.osgeo.org/​wiki/​Main_Page|GRASS wiki]].
  
Line 45: Line 49:
  
   * [[http://​open.canada.ca/​data/​en/​dataset|Canada'​s open data portal]].   * [[http://​open.canada.ca/​data/​en/​dataset|Canada'​s open data portal]].
-  * [[https://​www.donneesquebec.ca/​fr/​|Données ouvertes Québec]]+  * [[https://​www.donneesquebec.ca/​fr/​|Données ouvertes Québec]].
   * [[http://​www.gadm.org/​|Global Administrative Areas]].   * [[http://​www.gadm.org/​|Global Administrative Areas]].
   * [[http://​www.naturalearthdata.com/​|Natural Earth]].   * [[http://​www.naturalearthdata.com/​|Natural Earth]].
Line 66: Line 70:
 Note: You can compare the possibilities offered by modern day GIS with the first ever GIS, created in 1965 for the Canada Land Inventory. See these videos on Youtube: Data for decision [[http://​www.youtube.com/​watch?​v=eAFG6aQTwPk|Part I]], [[http://​www.youtube.com/​watch?​v=3kFYsOHgDSo|Part II]] et [[http://​www.youtube.com/​watch?​v=ryWcq7Dv4jE|Part III]]. ​ Note: You can compare the possibilities offered by modern day GIS with the first ever GIS, created in 1965 for the Canada Land Inventory. See these videos on Youtube: Data for decision [[http://​www.youtube.com/​watch?​v=eAFG6aQTwPk|Part I]], [[http://​www.youtube.com/​watch?​v=3kFYsOHgDSo|Part II]] et [[http://​www.youtube.com/​watch?​v=ryWcq7Dv4jE|Part III]]. ​
  
 +===== 4 - Exercises =====
  
-===== Download files needed for exercises ====+==== Download files needed for exercises ====
 {{::​qcbs_workshop_introgis_files.zip|Click here to download a ZIP file}} containing all the files needed for the exercises below. {{::​qcbs_workshop_introgis_files.zip|Click here to download a ZIP file}} containing all the files needed for the exercises below.
-======== 4 - Exercises ======== 
  
 ====== Exercise 1 - Digitizing and map display ===== ====== Exercise 1 - Digitizing and map display =====
  
-**Ojective: Create a map of the two McGill forests in the Montreal West Island: The Morgan Arboretum and the Molson Reserve. Draft a plan for the expansion of these reserves and create nice maps outlining your plan.** ​+**Objective: Create a map of the two McGill forests in the Montreal West Island: The Morgan Arboretum and the Molson Reserve. Draft a plan for the expansion of these reserves and create nice maps outlining your plan.** ​
  
 **Step 1**: Open a text editor (for example, Notepad in Windows or TextEdit on Mac) and copy the following latitude , longitude coordinates in decimal degrees to it.  **Step 1**: Open a text editor (for example, Notepad in Windows or TextEdit on Mac) and copy the following latitude , longitude coordinates in decimal degrees to it. 
Line 82: Line 85:
 2,​MolsonReserve,​-73.9763,​45.3943 2,​MolsonReserve,​-73.9763,​45.3943
 </​file>​ </​file>​
-Then save as a text file with a .csv extension ​and add this as a vector layer to the QGIS map canvas with the >​Layer>'​Add Delimited ​Text Layer'​. Use Longitude as the X column ​and Latitude as the Y column. Specify >​Geographic coordinate systems>​WGS 84 as the CRS. Now, you should see two points on your screen indicating the center of each reserve+**Note for Mac users: make sure your TextEdit is using Plain Text and not Rich Text format by going in the preferences of TextEdit ​and reopening ​the program.**
  
-**Step 2**: Add Google Hybrid layer by clicking on plugins ​and by installing ​the QuickMapServices plugin. Then go in web>QuickMapServices>Settings>More services and click on Add contributed packThen, add the Google Hybrid layer to the canvas from the web>QuickMapServices menu+Then save as text file with a ''​.csv''​ extension ​and add this as a vector layer to the QGIS map canvas with the ''​>Layer >Add Layer >​Add ​Delimited Text Layer''​Use Longitude as the X column and Latitude as the Y column. Specify ''​>Geographic coordinate systems >WGS 84''​ as the CRS. Now, you should see two points on your screen indicating the center of each reserve
  
-**Step 2 alternative**:​ Add a Google Satellite layer by clicking on the Browser>​XYZ tiles, right-click and select New connection. For the name, specify Google Satellite. For the URL, put +**Step 2**: Add a Google Hybrid layer by clicking on ''​plugins''​ and by installing the QuickMapServices plugin. Then go in ''>​Web >​QuickMapServices >​Settings >More services''​ and click on ''​Add contributed pack''​. Then, add the Google Hybrid layer to the canvas from the ''​web >​QuickMapServices >​Google''​ menu.  
 + 
 +**Step 2 alternative**:​ Add a Google Satellite layer by clicking on the ''​Browser >XYZ tiles''​, right-click and select ​''​New connection''​. For the name, specify ​'Google Satellite'. For the URL, put 
  
 <​file>​ <​file>​
 http://​mt0.google.com/​vt/​lyrs=y&​hl=en&​x={x}&​y={y}&​z={z}&​s=Ga http://​mt0.google.com/​vt/​lyrs=y&​hl=en&​x={x}&​y={y}&​z={z}&​s=Ga
 </​file>​ </​file>​
-Note that the CRS of the canvas is now (WGS84/ Pseudo Mercator). Move this layer to the bottom in the Layers list. You can find other sources of tiles here (https://​leaflet-extras.github.io/​leaflet-providers/​preview/​) 
  
-**Step 3**: Click on the CRS modification button ​on the bottom right of your screen and change the CRS to NAD83/UTM Zone 18N. +To facilitate working with a background layer, click on the earth icon on the bottom right of your screen ​that specifies an EPSG number ​and change the Reference system ​to (WGS84/ Pseudo Mercator).  
 + 
 +Move this background layer to the bottom in the Layers list by clicking on it and dragging it below your previous point layer. You can find other sources of tiles here (https://​leaflet-extras.github.io/​leaflet-providers/​preview/​) 
 + 
 +**Step 3**: To digitize the two reserves, you need to add a new empty polygon layer (''>​Layer >Create Layer >New Geopackage layer''​). Specify the CRS as NAD 83/UTM zone 18N and polygon as the geometry type. A column/​attribute for ID (integer) is already specified, add one for Name (Text data) by specifying a Name in the 'New field' section and clicking Add to fields list. Give the new Geopackage database an appropriate name (ex. mtl_region) and make sure it's in a appropriate folder on your computer by clicking on the ''​...''​ menu. Specify an appropriate name for the layer as well (ex. McGill_Reserves). Click OK and Enable Edit mode by left-clicking on the layer name in the left menu and selecting ''​Toggle Editing''​. 
 + 
 +**Step 4**: Digitize the McGill Molson Reserve and the Morgan Arboretum from the satellite image. To help you locate those areas, use the points which you imported from the ''​.csv''​ file. For the Molson Reserve, digitize the forested area located between the residential street (Blvd. Perrot) and highway 20 by clicking on the digitize icon: {{:​capture_du_2013-09-25_10_58_40.png?​nolink&​40|}}. For the Arboretum, digitize the contiguous forested area surrounding the point. The Arboretum is approximately 250 hectares.  
 + 
 +**Step 5**: Now add polygons adjacent to those polygons corresponding to what you propose as extensions to the existing reserves. For two adjacent polygons to properly share a common boundary, you need to digitize the second polygon so as to make it overlap slightly the first one. For this to work, it is important to enable snapping by clicking on the red magnet icon and setting an appropriate snapping tolerance (ex 20 meters). If you don't see the snapping options toolbar, enable the Snapping toolbar under ''>​View >​Toolbar''​
  
-**Step ​4**: To digitize the two reservesyou need to add a New empty polygon layer (>​Layer>​Create Layer>​Geopackage layer). Specify the CRS as NAD 83/UTM zone 18N and polygon as the geometry type. A column/​attribute for ID (integer) is already specified, add one for Name (Text data) by specifying a Name in the 'New field' section and Clicking Add to fields list. Give the new Geopackage database an appropriate name (ex. mtl_region) and make sure it's in a appropriate folder on your computer by clicking on the ... menu. Specify and appropriate name for the layer as well (ex. McGill_Reserves). Click OK and Enable ​Edit mode by left-clicking ​on the layer name in the left menu and selecting '​Toggle editing'​. Digitize the McGill Molson Reserve and the Morgan Arboretum from the satellite image. To help you locate those areas, use the points which you imported from the CSV file. For the Molson Reserve, digitize the forested area located between the residential street (Blvd. Perrot) and highway 20 by clicking on the digitize icon: {{:​capture_du_2013-09-25_10_58_40.png?​nolink&​40|}}. For the Arboretum, digitize the contiguous forested area surrounding the point. The Arboretum is approximately 250 hectares. Now add polygons adjacent to those polygons showing what you propose as extensions ​to the existing reserves. For two adjacent polygons to properly share a common boundary, you need to digitize the second polygon so as to make it overlap slightly the first one. For this to work, it is important to enable snapping by clicking on the red magnet icon and setting an appropriate snapping tolerance (ex 20 meters). If you don't see the snapping options toolbar, enable the Digitizing toolbar under View>​toolbar+**Step ​6**: When doneexit Edit mode (click ​on pencil icon) and choose ​to save the layer
  
-**Step ​5**: When doneexit Edit mode (click on pencil icon) and choose to save the layer+**Step ​7**: From the ''>​Layer >​Properties >​Symbology''​ menu, change the colours of the two reserves, add the names of the reserves as labels, and put appropriate labels for the extensions of the reserves that you are proposing 
  
-**Step ​6**: From the Layer>Properties>​Symbology ​menu, change the colors of the Two reserves, add the names of the reserves as labels, and put appropriate labels for the extensions of the reserves that you are proposing.  ​+**Step ​8**: Assign appropriate colours for each layer in the Style tab of the ''>​Layer Properties'' ​menu. From the ''​.zip''​ file downloaded above, add the roads (Routes.shp)other forested areas (region_boise.shp) ​and water bodies (Region_hydrique.shp) to the map canvas.  ​
  
-**Step ​7**: Assign appropriate colors for each layer in the Style tab of the Layer Properties menu. From the zip file downloaded above, add the roads (Routes.shp),​ other forested areas (region_boise.shp) and water bodies (Region_hydrique.shp) to the map canvas.  ​Then, using the Print layout dialog (>​Project>​New Print Layout), generate a map that shows the reserves you have digitized, complete with a title, a North Arrow, Labels, and a legend. Note: When you open the Print Layout, you are presented with an empty page. To add the map, you need to click on the "Add new map to the layout"​ button and click-drag the area on the map where you want the map to appear. ​+**Step ​9**: Then, using the Print layout dialog (''​>Project >New Print Layout''​), generate a map that shows the reserves you have digitized, complete with a title, a North Arrow, Labels, and a legend. ​//Note: When you open the Print Layout, you are presented with an empty page. To add the map, you need to click on the "Add new map to the layout"​ button and click-drag the area on the map where you want the map to appear.// 
  
 **CHALLENGE**:​ Add the pipelines and powerlines to the map, that you will download from Open Street Maps using the Quick OSM plugin. ​ **CHALLENGE**:​ Add the pipelines and powerlines to the map, that you will download from Open Street Maps using the Quick OSM plugin. ​
Line 109: Line 121:
 **Objective:​ Find out the proportion of voters living within 500 m of a forested area larger than 10 hectares in the Jacques-Cartier provincial electoral district in the Montreal West Island.** **Objective:​ Find out the proportion of voters living within 500 m of a forested area larger than 10 hectares in the Jacques-Cartier provincial electoral district in the Montreal West Island.**
  
-**Step 1**: Start a new project and open the files named '​sections_vote_31h5.shp'​ and '​regions_boise.shp'​. Convert these files to the NAD83/UTM 18N CRS by saving them as new layers in a new Geopackage (right click on the layer name in the left menu Export>​Save feature as). +**Step 1**: Start a new project and open the files named '​sections_vote_31h5.shp'​ and '​regions_boise.shp'​. Convert these files to the NAD83/UTM 18N CRS by saving them as new layers in a new Geopackage (right click on the layer name in the left menu ''>​Export >Save feature as''​). 
  
 **Step 2**: Start a new project again and set the project CRS to NAD83/UTM 18N. Add the two layers you just saved. ​ **Step 2**: Start a new project again and set the project CRS to NAD83/UTM 18N. Add the two layers you just saved. ​
  
-**Step 3**: Open the Regions boisées attribute table (right click... Open attribute table) and add a column containing the area in hectares of each forest. To do this, toggle the layer editing (pencil icon) and use the Field Calculator (small calculator icon) to create the new column (use the Geometry>​$area operator). Note that the UTM coordinate system is in meters and 1 hectare = 10,000 square meters. Important: Specify '​Decimal Number (real)'​, put the output width at 15 and increase the precision to 2.  ​+**Step 3**: Open the Regions boisées attribute table (right click... ​''>​Open attribute table''​) and add a column containing the area in hectares of each forest. To do this, toggle the layer editing (pencil icon) and use the Field Calculator (small calculator icon) to create the new column (use the ''>​Geometry >$area'' ​operator). Note that the UTM coordinate system is in meters and 1 hectare = 10,000 square meters. Important: Specify '​Decimal Number (real)'​.  ​
  
-**Step 4**: Exit Edit mode and create a Filter (>​Layer>​Filter) to isolate the forested areas larger than 10 hectares. Note that you can't perform a query while you are in Edit mode. +**Step 4**: Exit Edit mode and create a Filter (''​>Layer >Filter''​) to isolate the forested areas larger than 10 hectares. Note that you can't perform a query while you are in Edit mode. 
  
-**Step 5**: Create a new shapefile ​with a 500 m buffer surrounding the forested areas (>​Vector>​Geoprocessing tools>​Buffer).+**Step 5**: Create a new vector layer with a 500 m buffer surrounding the forested areas (''​>Vector >​Geoprocessing tools >Buffer''​). You can leave fields other than Distance as they are
  
-**Step 6**: Add an area column to the sections_vote_31h5 attribute table. ​+**Step 6**: Add an area column to the sections_vote_31h5 attribute table (see Step 3)
  
 **Step 7**: Create a Filter to select only the Jacques-Cartier electoral district (TRI_CEP column). ​ **Step 7**: Create a Filter to select only the Jacques-Cartier electoral district (TRI_CEP column). ​
  
-**Step 8**: Run the 'Basic Statistics for fields'​ function under Vector>​Analysis tools to calculate the total number of voters in Jacques-Cartier (2008_12_08 column). Write this number down. +**Step 8**: Run the 'Basic Statistics for fields'​ function under ''>​Vector >​Analysis tools'' ​to calculate the total number of voters in Jacques-Cartier (2008_12_08 column). Write this number down. 
  
-**Step 9**: Use the Clip function (>​Vector>​Geoprocessing tools>​Clip) to generate a vector containing only the electoral zone sections (input layer) of the Jacques-Cartier district within the buffer around the forests (clip layer). ​ You will notice that the size of some districts has significantly decreased. ​+**Step 9**: Use the Clip function (''​>Vector >​Geoprocessing tools> Clip''​) to generate a vector containing only the electoral zone sections (input layer) of the Jacques-Cartier district within the buffer around the forests (clip layer). ​ You will notice that the size of some districts has significantly decreased. ​
  
-**Step 10**: To estimate the number of voters within the buffer, we will assume that the number of voters is proportional to the area of each voting zone and calculate the proportion of each zone located within the buffer. Open the attribute table of the Shapefile ​created in Step 9. Create a column containing the new area ($area) of each disctrict ​after the clip. Now, create a column with the number of voters (2008_12_08 column) multiplied by the proportion of the area of each zone falling within the buffer:+**Step 10**: To estimate the number of voters within the buffer, we will assume that the number of voters is proportional to the area of each voting zone and calculate the proportion of each zone located within the buffer. Open the attribute table of the layer created in Step 9. Create a column containing the new area ($area) of each district ​after the clip. Now, create a column with the number of voters (2008_12_08 column) multiplied by the proportion of the area of each zone falling within the buffer:
  
 <​code>​ <​code>​
Line 133: Line 145:
 </​code>​ </​code>​
  
-**Step 11**: Use the 'Basic Statistics for fields'​ (Vector>​Analysis tools) function to find the sum of the 2008_12_08 column. Calculate the proportion by hand using the answer from Step 8.  ​+**Step 11**: Use the 'Basic Statistics for fields'​ (''>​Vector >​Analysis tools''​) function to find the sum of the 2008_12_08 column. Calculate the proportion by hand using the answer from Step 8.  ​
  
  
Line 142: Line 154:
 ++++ ++++
  
-**CHALLENGE** : Find which of the electoral districts shown on the map contains the largest cumulative length of roads. Use the Dissolve and Sum line lengths (in Vectors ​menu) functions.+**CHALLENGE** : Find which of the electoral districts shown on the map contains the largest cumulative length of roads. Use the Dissolve and Sum line lengths (in ''>​Vector'' ​menu) functions.
  
 ++++ Answer | ++++ Answer |
Line 156: Line 168:
 **Step 1**: Start a new project. **Step 1**: Start a new project.
  
-**Step 2**: Add the province.shp to the canvas and select the province of Quebec with the "​Select feature"​{{::​screenshot_from_2014-11-27_15_19_50.png|}} icon. Now save it as a new layer (ex. qc_outline) in a new Geopackage (ex. quebec) with the NAD 83/Quebec Lambert CRS, by right-clicking on the layer name and choosing ​"Export>​Save Feature as.." ​and then click on "save only selected features"​. ​+**Step 2**: Add the province.shp to the canvas and select the province of Quebec with the "​Select feature"​{{::​screenshot_from_2014-11-27_15_19_50.png|}} icon. Now save it as a new layer (ex. qc_outline) in a new Geopackage (ex. quebec) with the NAD 83/Quebec Lambert CRS, by right-clicking on the layer name and choosing ​''>​Export >Save Feature as..'' ​and then click on "save only selected features"​. ​
  
-**Step 3**: Add the Comma separated value file named '​BBS_Routes_QC.csv'​ to the map canvas using the function Add layer>'Add delimited text layer'​. Choose Point coordinates under Geometry definition and Latitude and Longitude as the Y and X fields. Specify the CRS WGS84 (Geographic).+**Step 3**: Add the Comma separated value file named '​BBS_Routes_QC.csv'​ to the map canvas using the function ​''>​Add layer> Add delimited text layer''. Choose Point coordinates under Geometry definition and Latitude and Longitude as the Y and X fields. Specify the CRS WGS84 (Geographic).
  
 **Step 4**: Save this layer as a new layer '​BBS_Routes_QC'​ in the geopackage above with the CRS: NAD83 / Quebec Lambert. ​ **Step 4**: Save this layer as a new layer '​BBS_Routes_QC'​ in the geopackage above with the CRS: NAD83 / Quebec Lambert. ​
  
-**Step 5**: Remove the shapefile layers and just keep the new layers from steps 2 and 4 to the canvas. Make sur the CRS of the canvas is NAD83 / Quebec Lambert.  ​+**Step 5**: Remove the shapefile layers and just keep the new layers from steps 2 and 4 to the canvas. Make sure the CRS of the canvas is NAD83 / Quebec Lambert.  ​
  
-**Step 6**: Add the (non-spatial) table '​BBS_Ovenbird_QC.csv'​ to the canvas using '​Layers>​Add Layer>​Add ​Vector ​Layer' and by choosing All files in the file types (yes, this is counterintuitive...)+**Step 6**: Add the (non-spatial) table '​BBS_Ovenbird_QC.csv'​ to the canvas using ''>Layers >Add Layer >​Add ​Delimited Text Layer'' and specifying "No geometry" ​in the geometry options
  
-**Step 8**: From the menu 'Layer properties'​ of the layer '​BBS_Routes_QC',​ find the Joins tab, click on the (+) symbol and join the table BBS_Routes and BBS_Ovenbird_QC using the shared column '​Route'​ (select Route as both the source and the target columns). Disable the option to "Cache join layer in virtual ​memory"​. You should now see the number of ovenbird observations per year in the attribute table of the '​BBS_Routes_QC'​ file. +**Step 8**: From the menu ''>Layer properties'' of the layer '​BBS_Routes_QC',​ find the Joins tab, click on the (+) symbol and join the table BBS_Routes and BBS_Ovenbird_QC using the shared column '​Route'​ (select Route as both the source and the target columns). Disable the option to "Cache join layer in memory"​. You should now see the number of ovenbird observations per year in the attribute table of the '​BBS_Routes_QC'​ file. 
  
-**Step 9**: Activate the editing mode and use the 'Field Calculator'​ to add a new column (real, precision 2) to the table BBS_Routes containing the sum of the number of bird observations between 1980-1994 and 1995-2010. Each field has to be selected one by one from the Fields and Values list (sorry). Column names should have less than 10 characters, should start with a letter and should contain no spaces or special characters.+**Step 9**: Activate the editing mode and use the 'Field Calculator'​ to add a new column (real) to the table BBS_Routes containing the sum of the number of bird observations between 1980-1994 and 1995-2010. Each field has to be selected one by one from the Fields and Values list (sorry). Column names should have less than 10 characters, should start with a letter and should contain no spaces or special characters.
  
-**Step 10**: Save the changes and exit editing mode. Note that only the new columns that were created are really part of the BBS_Routes_QC table. Now remove the join (from the Properties menu) to remove the yearly observations. If you see a series of NULL values in the newly computed columns, close the attribute table and open it again. ​+**Step 10**: Save the changes and exit editing mode. Note that only the new columns that were created are really part of the BBS_Routes_QC table. Now remove the join (from the ''>​Properties'' ​menu) to remove the yearly observations. If you see a series of NULL values in the newly computed columns, close the attribute table and open it again. ​
  
-**Step 11**: You will now create a continuous interpolated surface showing the distribution of ovenbirds for each period. Make sure that the map canvas uses the same CRS as that of the BBS_Routes_QC layer. Find IDW Interpolation under the Processing Toolbox menu. Specify BBS_Routes_QC as the input vector layer and choose the column corresponding to the earliest period as the interpolation attribute field. You need to define the number of columns, number of rows and Extent to obtain an output raster with a resolution of 2km x 2km *exactly* so that you can include most of the points (you can exclude points in Northern Quebec), but without extending too much outside of the extent covered by the points. Don't hesitate to use a calculator and the image below: ​+**Step 11**: You will now create a continuous interpolated surface showing the distribution of ovenbirds for each period. Make sure that the map canvas uses the same CRS as that of the BBS_Routes_QC layer. Find IDW Interpolation under the ''>​Processing Toolbox'' ​menu. Specify BBS_Routes_QC as the input vector layer and choose the column corresponding to the earliest period as the interpolation attribute field. You need to define the number of columns, number of rows and Extent to obtain an output raster with a resolution of 2km x 2km *exactly* so that you can include most of the points (you can exclude points in Northern Quebec), but without extending too much outside of the extent covered by the points. Don't hesitate to use a calculator and the image below: ​
  
 {{:​raster_res.png?​200x140|}} {{:​raster_res.png?​200x140|}}
  
  
-**Step 12**: Use the Clip Raster by Mask Layer (under Raster>​Extraction) to remove the part of the Interpolated raster map you just created that falls outside of the boundaries of the province. Choose province.shp as the mask layer (make sure it's in the right CRS)+**Step 12**: Use the Clip Raster by Mask Layer (under ​''>​Raster >​Extraction''​) to remove the part of the Interpolated raster map you just created that falls outside of the boundaries of the province. Choose ​the province ​of QC layer (from step 2) as the mask layer. ​
  
 Repeat Step 11-12 for the later (1995-2012) time period. Repeat Step 11-12 for the later (1995-2012) time period.
  
-**Step 13**: In the properties of the first layer, develop a new color palette appropriate for the values of the layer (Properties>​Symbology>​Render Type>​Single band pseudocolor). Choose a linear color interpolation,​ click on the "​+"​ symbol and define three relevant number values associated with each color (you can click on the raster with the '​Identify Features'​ tool to see the range of values). Choose three associated colors that give a good contrast. Choose to Save the style (bottom right). For the other raster covering the later period access the Style properties and Load the style you just saved. Now the same palette should be assigned to the two periods. Do you notice any difference in the spatial distribution of the ovenbirds over time?+**Step 13**: In the properties of the first layer, develop a new color palette appropriate for the values of the layer (''>​Properties >​Symbology >Render Type >Single band pseudocolor''​). Choose a linear color interpolation,​ click on the "​+"​ symbol and define three relevant number values associated with each color (you can click on the raster with the '​Identify Features'​ tool to see the range of values). Choose three associated colors that give a good contrast. Choose to Save the style (bottom right). For the other raster covering the later period access the Style properties and Load the style you just saved. Now the same palette should be assigned to the two periods. Do you notice any difference in the spatial distribution of the ovenbirds over time?
  
-**CHALLENGE 1**: Add a colum to the BBS Routes file showing the mean annual temperature (from the layer Quebec_mat_tenths.txt in degrees C x 10) in a radius of 20 km around each route. You will need the function 'Zonal Statistics'​ which can be found in the Processing Toolbox. ​+**CHALLENGE 1**: Add a column ​to the BBS Routes file showing the mean annual temperature (from the layer Quebec_mat_tenths.txt in degrees C x 10) in a radius of 20 km around each route. You will need the function 'Zonal Statistics'​ which can be found in the Processing Toolbox. ​
  
 **CHALLENGE 2**: Regenerate your interpolated raster maps for each time periods using the Multi-level B-Spline Interpolation tool in Saga. Use the Processing toolbox for this. Compare those maps with the ones you obtained with Inverse Distance Weighting. ​ **CHALLENGE 2**: Regenerate your interpolated raster maps for each time periods using the Multi-level B-Spline Interpolation tool in Saga. Use the Processing toolbox for this. Compare those maps with the ones you obtained with Inverse Distance Weighting. ​
-====== ​Exercice ​4 - Downloading files, recap and challenge! ====== +====== ​Exercise ​4 - Downloading files, recap and challenge! ====== 
-For this exercise, you will need to extract the mean elevation and the land cover at occurence ​sites of the [[http://​www.gbif.org/​|Global Biodiversity Information Facility (GBIF)]] falling within the Wemindji aboriginal territory, in the James Bay area of Quebec. **You will want to work with the UTM Zone 17N / NAD83 reference system**. Note that to reproject a raster, the preferred way is to use Raster>​Projections>​Warp. To achieve the objective, you will need to complete the following steps: ​+For this exercise, you will need to extract the mean elevation and the land cover at occurrence ​sites of the [[http://​www.gbif.org/​|Global Biodiversity Information Facility (GBIF)]] falling within the Wemindji aboriginal territory, in the James Bay area of Quebec. **You will want to work with the UTM Zone 17N / NAD83 reference system**. Note that to reproject a raster, the preferred way is to use ''>​Raster >​Projections >Warp''​. To achieve the objective, you will need to complete the following steps: ​
  
   * On the [[https://​open.canada.ca/​en/​open-data|Canada Open Government]] website, download raster [[http://​ftp.geogratis.gc.ca/​pub/​nrcan_rncan/​elevation/​cdem_mnec/​|elevation files]] for zones 33D and 33E at the 1:250,000 scale.   * On the [[https://​open.canada.ca/​en/​open-data|Canada Open Government]] website, download raster [[http://​ftp.geogratis.gc.ca/​pub/​nrcan_rncan/​elevation/​cdem_mnec/​|elevation files]] for zones 33D and 33E at the 1:250,000 scale.
-  * Download this {{::​qc_land_use_33de.zip|ZIP package}} containing a tif file with a recent land cover classification of the area and the associated style/​colormap in qml format. ​+  * Download this {{::​qc_land_use_33de.zip|ZIP package}} containing a ''​.tif'' ​file with a recent land cover classification of the area and the associated style/​colormap in ''​.qml'' ​format. ​
   * On the MERN website (https://​mern.gouv.qc.ca/​territoire/​portrait/​portrait-donnees-mille.jsp),​ download the "​Découpages administratifs",​ "​Municipalités,​ TNO et territoires autochtones"​ dataset as a shapefile. You will want the polygon layer. ​   * On the MERN website (https://​mern.gouv.qc.ca/​territoire/​portrait/​portrait-donnees-mille.jsp),​ download the "​Découpages administratifs",​ "​Municipalités,​ TNO et territoires autochtones"​ dataset as a shapefile. You will want the polygon layer. ​
-  * Download {{::​occurrence.txt|this file}} containing the [[http://​www.gbif.org/​|GBIF]] species ​occurences ​in the Wemindji region. Note that this file is TAB delimited and the coordinates are in Latitude, longitude (WGS84). You can open it in a text editor to explore it's content.  +  * Download {{::​occurrence.txt|this file}} containing the [[http://​www.gbif.org/​|GBIF]] species ​occurrences ​in the Wemindji region. Note that this file is TAB delimited and the coordinates are in Latitude, longitude (WGS84). You can open it in a text editor to explore it's content.  
-  * Using the latitude, longitude coordinates,​ add the GBIF occurences ​to the map canvas (it is TAB delimited).  +  * Using the latitude, longitude coordinates,​ add the GBIF occurrences ​to the map canvas (it is TAB delimited).  
-  * Merge the elevation raster layers (.tif) into one using Raster>​Miscellaneous>​Merge. Save the output as a .tif file. +  * Merge the elevation raster layers (''​.tif''​) into one using ''>​Raster >​Miscellaneous >Merge''​. Save the output as a ''​.tif'' ​file. 
   * Use a filter to isolate the Wemindji territory (MUS_MN_MUN column)from the municipalities layer. ​   * Use a filter to isolate the Wemindji territory (MUS_MN_MUN column)from the municipalities layer. ​
   * Clip the occurrences to obtain only those within the Wemindji territory. ​   * Clip the occurrences to obtain only those within the Wemindji territory. ​
-  * Use the 'point sampling tool' plugin to extract the name of each species in latin, the land cover and the elevation at each occurrence location. Note that some locations contain a large number of occurrences. ​+  * Use the 'point sampling tool' plugin to extract the name of each species in Latin, the land cover and the elevation at each occurrence location. ​//Notesome locations contain a large number of occurrences.// 
  
 **CHALLENGE**:​ Use the Kernel Density Estimation tool in SAGA (Processing toolbox) to obtain a raster showing the density of all bird occurrences in the GBIF occurrence data provided. **CHALLENGE**:​ Use the Kernel Density Estimation tool in SAGA (Processing toolbox) to obtain a raster showing the density of all bird occurrences in the GBIF occurrence data provided.
-====== ​Exercise 5 - Manipulation of rasters and intro to satellite imagery ======+====== ​Extra exercise 1 - Manipulation of rasters and intro to satellite imagery ======
  
-**Objective:​ create an RGB false color composite image and an NDVI (Normalized Difference Vegetation Index) map, associate it with a color palette and extract the mean NDVI for parcs and fields of the region. Find which park is least vegetated** ​+**Objective:​ create an RGB false color composite image and an NDVI (Normalized Difference Vegetation Index) map, associate it with a color palette and extract the mean NDVI for parks and fields of the region. Find which park is least vegetated.** 
  
-**Step 1**: We will first create a false-color composite image to better visualize the contrasts. To do so, find the merge function under Raster>​Miscellaneous. Choose Landsat images 4,3 and 2 (you might need to click on them in that order, depending on your operating system) as the input files, specify Landsat_432.tif as the Output, and select "Put each input file into a separate band" option. In the Symbologie properties ​of the new layer, the Landsat band 4 should become band 1 (Red), Landsat band 3 should become band 2 (Green) and Landsat band 2 should become band 3 (Blue). Yes, this is confusing. ​+**Step 1**: We will first create a false-color composite image to better visualize the contrasts. To do so, find the merge function under ''>​Raster >​Miscellaneous''​. Choose Landsat images 4,3 and 2 (you might need to click on them in that order, depending on your operating system) as the input files, specify Landsat_432.tif as the output, and select "Put each input file into a separate band" option. In the Symbology Properties ​of the new layer, the Landsat band 4 should become band 1 (Red), Landsat band 3 should become band 2 (Green) and Landsat band 2 should become band 3 (Blue). ​(Yes, this is confusing.)
  
 **Step 2**: In the Symbology section, you'll notice that "​Multiband color" is used as the Render type. You can play with the brightness, contrast and saturation to improve the visual appearance of the image. Notice how this image can easily allow you to distinguish the vegetation, suburbs, cities and rivers. You can also create a 5-4-3 composite and compare the two images. **Step 2**: In the Symbology section, you'll notice that "​Multiband color" is used as the Render type. You can play with the brightness, contrast and saturation to improve the visual appearance of the image. Notice how this image can easily allow you to distinguish the vegetation, suburbs, cities and rivers. You can also create a 5-4-3 composite and compare the two images.
Line 220: Line 232:
 **Step 4**: In the properties menu of that layer, select Single band pseudo color as the Render type, choose the RdYlGn color map and click on Classify. On this map, dark green areas represent areas that are densely vegetated while reddish areas are not vegetated. ​ **Step 4**: In the properties menu of that layer, select Single band pseudo color as the Render type, choose the RdYlGn color map and click on Classify. On this map, dark green areas represent areas that are densely vegetated while reddish areas are not vegetated. ​
  
-**Step 5**: Add the layer containing the parcs and fields (parcs_terrains_sports.shp) to the canvas and save it as a new file with the CRS NAD83 / UTM 18N. Add the new file to the canvas and remove the old one. +**Step 5**: Add the layer containing the parks and fields (parcs_terrains_sports.shp) to the canvas and save it as a new file with the CRS NAD83 / UTM 18N. Add the new file to the canvas and remove the old one. 
  
-**Step 6**: Find the Zonal statistics menu in the Procesing Toobox. Choose the parcs et terrains as the vector layer and the NDVI image as the raster layer. ​+**Step 6**: Find the Zonal Statistics entry in the Processing Toolbox. Choose the 'parcs et terrains' ​as the vector layer and the NDVI image as the raster layer. ​
  
-**Step 7**: By looking at the attribute table of the parcs et terrains layer, you will see that columns were added with the statistics of the NDVI cells for each field and park. Which park has the the lowest Mean NDVI (click on the column name to sort)? Where is it located (Click on the zoom to selection icon)?+**Step 7**: By looking at the attribute table of the 'parcs et terrains' ​layer, you will see that columns were added with the statistics of the NDVI cells for each field and park. Which park has the the lowest Mean NDVI (click on the column name to sort)? Where is it located (Click on the zoom to selection icon)?
  
 ++++ Answer | ++++ Answer |
  
-The park is located North of autoroute 40 in Ville Saint-Laurent (number 305, mean ndvi: -0.31). If you add a Google satellite layer to the canvas, you will note that there are no parks at that location, explaining the very low NDVI value.  ​+The park is located North of autoroute 40 in Ville Saint-Laurent (number 305, mean NDVI: -0.31). If you add a Google satellite layer to the canvas, you will note that there are no parks at that location, explaining the very low NDVI value.  ​
  
 ++++ ++++
  
 **CHALLENGE**:​ **CHALLENGE**:​
-Go to the USGS EarthExplorer website [[http://​earthexplorer.usgs.gov/​]] and create an account by clicking on register. Then, choose a region anywhere in the world about the size of the Montreal region that you think could have seen a lot of land use change in the last 30 years. Search for a  Landsat 4-5TM (Collection 1 Level 1) image dating anywhere between 1980-1990 for that region and taken in the summer months that contains less than 20% clouds. Download that file as a Level 1 product. Note the path/row information of this image and search for an equivalent image for 2010-2015 (same months, row and path). Bring them to QGIS, and calculate an NDVI value for each time period. ​Substract ​the later NDVI from the earlier NDVI and view the file with {{:​ndvidiff.qml|this palette}} (right-click the link...save as) to see the difference in vegetation cover between the two time periods. ​+Go to the USGS EarthExplorer website [[http://​earthexplorer.usgs.gov/​]] and create an account by clicking on register. Then, choose a region anywhere in the world about the size of the Montreal region that you think could have seen a lot of land use change in the last 30 years. Search for a  Landsat 4-5TM (Collection 1 Level 1) image dating anywhere between 1980-1990 for that region and taken in the summer months that contains less than 20% clouds. Download that file as a Level 1 product. Note the path/row information of this image and search for an equivalent image for 2010-2015 (same months, row and path). Bring them to QGIS, and calculate an NDVI value for each time period. ​Subtract ​the later NDVI from the earlier NDVI and view the file with {{:​ndvidiff.qml|this palette}} (right-click the link... ​''​Save ​as''​) to see the difference in vegetation cover between the two time periods. ​
  
 **CHALLENGE 2** **CHALLENGE 2**
-Use the Cluster Analysis for Grids function in Processing Toolbox>​SAGA to perform an unsupervised classification of your images using bands 3,4,5 and 7. +Use the Cluster Analysis for Grids function in ''>​Processing Toolbox >SAGA'' ​to perform an unsupervised classification of your images using bands 3,4,5 and 7. 
  
-====== ​Exercise 6 - Using GRASS with QGIS Processing toolbox ======+====== ​Extra exercise 2 - Using GRASS with QGIS Processing toolbox ======
  
-Objective: Isolate the largest contiguous patch of land that is not covered by water and that is at least 1km from roads. ​+**Objective: Isolate the largest contiguous patch of land that is not covered by water and that is at least 1km from roads.** 
  
 **Step 1**: Save the file routes.shp as a new layer with the CRS NAD83 / UTM 18N. Do the same for the Region_Hydrique shapefile. ​ **Step 1**: Save the file routes.shp as a new layer with the CRS NAD83 / UTM 18N. Do the same for the Region_Hydrique shapefile. ​