Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
introgis [2018/10/19 13:38]
qcbs [Exercise 2 - Buffers and basic analyses]
introgis [2019/11/12 17:17] (current)
qcbs [Exercice 4 - Downloading files, recap and challenge!]
Line 6: Line 6:
 Guillaume Larocque, Research Professional. (guillaume.larocque@mcgill.ca) Guillaume Larocque, Research Professional. (guillaume.larocque@mcgill.ca)
  
-October 23 and 242018. McGill University+November 12 and 132019. McGill University
  
 ===== Presentation ===== ===== Presentation =====
Line 58: Line 58:
   * [[http://​udig.refractions.net/​|uDIG]] - An interesting and user friendly GIS written in Java for data access, editing, and viewing. It is under active development at the moment. ​   * [[http://​udig.refractions.net/​|uDIG]] - An interesting and user friendly GIS written in Java for data access, editing, and viewing. It is under active development at the moment. ​
   * [[http://​www.saga-gis.org/​|SAGA GIS]] - (System for Automated Geoscientific Analyses) A powerful GIS mostly aimed at data analysis and spatial algorithms.  ​   * [[http://​www.saga-gis.org/​|SAGA GIS]] - (System for Automated Geoscientific Analyses) A powerful GIS mostly aimed at data analysis and spatial algorithms.  ​
-  * [[http://​www.uoguelph.ca/​~hydrogeo/​Whitebox/​|Whitebox]] - Powerful software for geo-spatial analysis, modeling and remote sensing. ​+  * [[http://​www.uoguelph.ca/​~hydrogeo/​Whitebox/​|Whitebox ​GAT]] - Powerful software for geo-spatial analysis, modeling and remote sensing.  
 +  * [[https://​www.orfeo-toolbox.org/​|ORFEO toolbox]] - Open source platform for remote sensing. ​
   * [[http://​52north.org/​communities/​ilwis|ILWIS Open]] - A remote sensing and GIS software which integrates image, vector and thematic data in one package on the desktop.   * [[http://​52north.org/​communities/​ilwis|ILWIS Open]] - A remote sensing and GIS software which integrates image, vector and thematic data in one package on the desktop.
   * [[http://​www.gvsig.org/​|gvSIG]] - A GIS currently in development having a user-friendly interface, being able to access the most common formats, and featuring a wide range of tools for query, layout creation, geoprocessing,​ networks, etc.    * [[http://​www.gvsig.org/​|gvSIG]] - A GIS currently in development having a user-friendly interface, being able to access the most common formats, and featuring a wide range of tools for query, layout creation, geoprocessing,​ networks, etc. 
Line 65: Line 66:
 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 - Getting started ===== 
-  * Open QGIS - Click on Plugins­ > Manage Plugins, and make sur fTools and GdalTools plugins are activated. 
-  * Now you will see a dropdown menu in QGIS with options for vector analysis (fTools), raster analysis (GdalTools) and multiple other plugins (under plugins). ​ 
-  * Go to Settings > Options ­­> CRS, and click on '​Enable on the fly reprojection by default'​. ​ 
-  * Start a New Project or close and reopen QGIS.  
- 
-Layers in different reference systems will then be reprojected on the fly.  
  
 ===== 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.
-======== ​- Exercises ========+======== ​- Exercises ========
  
 ====== Exercise 1 - Digitizing and map display ===== ====== Exercise 1 - Digitizing and map display =====
Line 88: Line 82:
 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' ​function (if this isn't showing up for you, activate it in the plugins). 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. ​+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. ​
  
-**Step 2**: Add a Google Satellite layer by clicking on the Browser>​XYZ tiles. Right-click and select ​Ne connection. For the name, specify Google Satellite. For the URL, put http://​mt0.google.com/​vt/​lyrs=y&​hl=en&​x={x}&​y={y}&​z={z}&​s=Ga ​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 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 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>​ 
 +http://​mt0.google.com/​vt/​lyrs=y&​hl=en&​x={x}&​y={y}&​z={z}&​s=Ga 
 +</​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.  **Step 3**: Click on the CRS modification button on the bottom right of your screen and change the CRS to NAD83/UTM Zone 18N. 
  
-**Step 4**: To digitize the two reserves, you need to add a New empty polygon layer (>​Layer>​Create Layer>Shapefile ​layer>Polygon). Specify the CRS as NAD 83/UTM zone 18N. 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 shapefile layer an appropriate ​file name (ex. McGill_Reserves.shp) and make sure it's in a appropriate folder on your computer by clicking on the ... menu. 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 select the '​Enable ​snapping on intersections.' ​for that layer in the > Settings ­­­­>​ Snapping Options dialog+**Step 4**: To digitize the two reserves, you 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 5**: When done, exit Edit mode and save the layer. ​+**Step 5**: When done, exit Edit mode (click on pencil icon) and choose to save the layer. ​
  
-**Step 6**: From the Layers properties ​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 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 7**: Assign appropriate colors for each layer in the Style tab of the Layer Properties menu. 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 Layour), 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 "Adds new map to the layout"​ button and click-drag the area on the map where you want the map to appear. ​+**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. ​
  
 **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 108: Line 109:
 **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 files (right click on the layer name in the left menu>​Save 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 files 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 and add a column containing the area in hectares of each forest. To do this, toggle the layer editing and use the Field Calculator (small calculator icon at the bottom) 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)',​ put the output width at 15 and increase the precision to 2.  ​
  
 **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. 
Line 155: Line 156:
 **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 shapefile ​with the NAD 83/Quebec Lambert CRS, by right-clicking on the layer name and choosing "Save 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 ​'​Selected delimiters'​->​comma) ​and 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 shapefile named '​BBS_Routes_QC.shp' 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**: Start a new project ​and specify ​the CRS NAD83 / Quebec Lambert. Add the files from steps 2 and to the canvas. ​+**Step 5**: Remove the shapefile layers ​and just keep the new layers ​from steps 2 and to the canvas. ​Make sur 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 listing all 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 Vector Layer' and by choosing All files in the file types (yes, this is counterintuitive...)
  
-**Step 8**: From the menu 'Layer properties'​ of the table '​BBS_Routes_QC.shp', find the Join tab 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 virtual 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, 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.
Line 171: Line 172:
 **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 ​file. Find >Grid (Interpolationunder >​Raster>​Analysis. Specify BBS_Routes_QC as the input and choose the column corresponding to the earliest period as the field. Use '​Inverse distance to a power' as the Algorithm. You need to define the Width (number of columns)Height (number of rowsand 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 Clipper function ​(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. ​+**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)
  
 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>​Tab Style>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 extension ​'Zonal Statistics'​ which can be found in '>​Raster>​Zonal Statistics'​ once installed+**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 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! ====== ====== Exercice 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 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: ​
  
-  * On the [[http://​open.canada.ca/​|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 Open Government ​website, download the shapefile ​of Aboriginal Lands of Canada Legislative BoundariesThe shapefile of interest is the one that ends with _MODIFIED ​+  * 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 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. ​
 +  * Using the latitude, longitude coordinates,​ add the GBIF occurences 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. 
-  * Using the latitude, longitude coordinates,​ add the GBIF occurences to the map canvas+  * 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. Note that some locations contain a large number of occurrences. ​
Line 202: Line 204:
 **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 parcs 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. ​If you have selected ​the files in the correct order, 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 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 2**: In the Style properties of this new Layer, 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.
  
 We will now create a Normalized Difference Vegetation Index image. ​ We will now create a Normalized Difference Vegetation Index image. ​
  
-**Step 3**: Find Raster calculator function. Specify '​NDVI'​ as the name of the output layer (GeoTiff). You then need to find bands 3 and 4 in the left menu, and come up with this formula in the Expression box: +**Step 3**: Find Raster calculator function ​in the Processing toolbox. Specify '​NDVI'​ as the name of the output layer (GeoTiff). You then need to find bands 3 and 4 in the left menu, and come up with this formula in the Expression box: 
  
 <​file>​ <​file>​
Line 220: Line 222:
 **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 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 6**: Install and enable ​the "Zonal statistics" plugin+**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 7**: Find the Zonal statistics menu under Raster. 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 8**: 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? Where is it located?+
  
 ++++ Answer | ++++ Answer |
Line 237: Line 237:
 **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 within ​QGIS ======+ 
 +====== Exercise 6 - 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**: Start QGIS by clicking on "QGIS with GRASS support"​. Make sure that the GRASS extension is activated, that the GRASS icons bar is selected in >​View>​Toolbar,​ and that it is not hidden somewhere in your icons barClick on the Plugins>​GRASS>​ New mapset and define ​a new GRASS Database, a new Location (name it workshop2), choose ​the CRS NAD83 / UTM 18 N, specify ​the default GRASS Region by using the current QGIS extent and specify a name for the Mapset+**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 2**: Save the file routes.shp as a new layer with the CRS NAD83 / UTM 18N. Do the same for the Region_Hydrique shapefile+**Step 2**: Convert ​the routes ​and the Region_Hydrique files to raster format using the v.to.rast function. Choose the "​Source for raster values" ​as "​va",​ and put 1 in the "​Raster value (use=val)"​. Do the same for the regions hydriques.
  
-**Step 3**: You now need to import ​the files into GRASSClick on 'Open GRASS tools' (if the tab is not already active), click on the '​Module tree'>'​File management'>'​Import into GRASS'>'​Import ​vector into GRASS'>'​v.in.ogr.qgis'​. Select ​the route file you created in step 2 and specify a name for the output fileRepeat this step for the Region hydrique file. Add the newly created GRASS files to the map canvas. Using the QGIS Browser, you can add GRASS files by finding your GRASS Database folder, opening the desired mapset and location, and dragging and dropping files from the Browser to the Layers Panel+**Step 3**: Use the r.grow.distance function to create ​continuous raster map in which each pixel is assigned ​the distance from the closest ​route. ​Use the routes layer in raster format (Step 6) as the input 
  
-**Step 4**: Find the function called ​r.in.gdal and import ​the 31h05dem.tif ​file to GRASSAdd this new GRASS layer to the QGIS map canvas+**Step 4**: Use the r.null.to function to replace ​the value of NULL with 0 in the Region Hydrique raster ​file. Do the same for the r.grow.distance file
  
-**Step 5**: Find the function g.region.multiple.raster and use the file imported in Step 4 to define the current region (specify the exact name of the raster layer in the box).  +**Step 5**: Use the r.mapcalc.simple ​function to remove the areas covered with water form the distance map you just created. Set layer A as the Region Hydrique raster layer from step 4 and B as the distance file created in Step 4
- +
-**Step 6**: Convert the routes file to raster format using the v.to.rast.constant function. Do the same for the regions hydriques. +
- +
-**Step 7**: Use the r.grow.distance function to create a continuous raster map in which each pixel is assigned the distance from the closest route. Use the routes layer in raster format (Step 6) as the input. ​  +
- +
-**Step 8**: Use the r.null.to function to replace the value of NULL with 0 in the Region Hydrique raster file.  +
- +
-**Step 9**: Use the r.mapcalculator ​function to remove the areas covered with water form the distance map you just created. Set layer A as the Region Hydrique raster layer and B as the File created in Step 7Click on the "Use region of this map" icon beside layer A. In the formula box, type+
  
 <​file>​ <​file>​
-((A-1)*-1)*B+r.mapcalc expression="​((A-1)*-1)*B" ​
 </​file>​ </​file>​
  
-and give a name to the output file.  +**Step ​6**: To exclude areas closer than 1km from roads, ​run r.reclass on the distance map from step 5 with the following ​reclass rule
- +
-**Step ​10**: To exclude areas closer than 1km from roads, ​create a text file (in text edit or Notepad) ​with the following ​content+
  
 <​file>​ <​file>​
Line 272: Line 263:
 </​file>​ </​file>​
  
-**Step ​11**: Use the r.reclass function to reclassify the raster you created in Step 9 and using the reclass rules file (Step 10).  +**Step ​7**: Use the r.clump function to give every isolated contiguous area a unique identifier. ​
- +
-**Step 12**: Use the r.clump function to give every isolated contiguous area a unique identifier. ​+
  
-**Step ​13**: Use the r.stats function to obtain the area of each contiguous area, or patch. ​You need to click on Advanced Options, select ​"Print area totals"​ and put "-" ​as the Name for output ​fileYou could also specify ​file name with a .txt extension if you want the output to be save in a text file+**Step ​8**: Use the r.stats function to obtain the area of each contiguous area, or patch. ​Unclick One cell (range) per line and click "Print area totals"​ and "Print category labels"​. Choose "desc" for Sort output ​statistics by cell countThen, click on the html file in the Results viewer and identify the patch ID with the second largest area (largest is the background).
  
-**Step ​14**: Identify ​the patch with the largest area. Find the GRASS Shell in the list of functions and write the following ​command: ​+**Step ​9**: Use r.reclass on the output from Step 8, with the following ​rule
 <​file>​ <​file>​
-r.mapcalc "​Largest_patch=if(Step_12  ​== ID, 1, null())" ​+ID 
 +NULLL
 </​file>​ </​file>​
-where you replace ID with the ID of the largest patch, and Step_12 with the name that you gave to the raster in Step 12. This will have created a raster map named Largest_patch in which the largest patch is isolated with a value of 1. You can now display this raster and change the Symbology to view the isolated patch.+where you replace ID with the ID of the largest patch. This will have created a raster map named Largest_patch in which the largest patch is isolated with a value of 1. You can now display this raster and change the Symbology to view the isolated patch.
  
-**Step ​15**: Convert this file to vector by using the r.to.vect.area function. ​+**Step ​10**: Convert this file to vector by using the r.to.vect function ​and add it to the canvas
 ====== GRASS Terminology====== ====== GRASS Terminology======
  
Line 303: Line 293:
  
  
-**The full list of GRASS commands [[https://​grass.osgeo.org/​grass64/​manuals/​full_index.html|is here.]]**+**The full list of GRASS commands [[https://​grass.osgeo.org/​grass74/​manuals/​full_index.html|is here.]]**