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 [2017/11/24 10:54]
qcbs [Exercice 3 - Interpolation and raster manipulation with QGIS]
introgis [2018/10/23 15:37] (current)
qcbs [Exercise 2 - Buffers and basic analyses]
Line 2: Line 2:
  
  
-Quebec Centre for Biodiversity Science, ​http://qcbs.ca+Quebec Centre for Biodiversity Science, ​https://qcbs.ca
  
 Guillaume Larocque, Research Professional. (guillaume.larocque@mcgill.ca) Guillaume Larocque, Research Professional. (guillaume.larocque@mcgill.ca)
  
-November ​23 and 24, 2017Concordia ​University+October ​23 and 24, 2018McGill ​University
  
 ===== Presentation ===== ===== Presentation =====
Line 13: Line 13:
 ===== 1 - Installation of QGIS and GRASS ===== ===== 1 - Installation of QGIS and GRASS =====
  
-QGIS 2.18 and GRASS 7 will be used for this workshop. Please make sure that you have the appropriate versions installed prior to the workshop. ​+QGIS and GRASS 7 will be used for this workshop. Please make sure that you have the appropriate versions installed prior to the workshop. ​
  
-**For Windows users**: Simply install QGIS and GRASS using the OSGeo4W installer available +Install QGIS and GRASS following [[https://​qgis.org/​en/​site/​forusers/​download.html|these instructions.]]
-[[http://​qgis.org/​en/​site/​forusers/​download.html|here]]. Choose and Express install and accept default values in other screens. +
- +
-**For Mac users**: Instructions to install QGIS and GRASS on Mac OS X are [[http://​www.kyngchaos.com/​software/​qgis|here]]. Please install GDAL before installing QGIS.  +
- +
- +
-++++ Instructions for Mac OSX Leopard-->​ | +
-For Mac OSX Leopard users: there are no complete packages available. The following packages have to be installed individually:​ +
- +
-<​file>​ +
-  * QGIS +
-  * GRASS 6.4.2 +
-  * GDAL Framework 1.8.1-1 "​Leo"​ +
-  * FreeType Framework 2.4.6 +
-  * cairo Framework 1.10.2 +
-  * UnixImageIO Framework 1.3.0 +
-  * PROJ Framework 4.7.0 +
-  * GEOS Framework 3.3.0 +
-  * SQLite3 Framework 3.7.6.3 +
- +
-UIIO, PROJ, GEOS, SQLite3, and GDAL are available at: http://​www.kyngchaos.com/​software/​frameworks#​gdal_complete +
-All others available at: http://​www.kyngchaos.com/​software/​archive +
- +
-First, copy QGIS from the .dmg into your applications folder (don't try to run it yet). Now install the packages in the following order: +
-  * FreeType +
-  * PROJ +
-  * UnixImageIO +
-  * cairo +
-  * GEOS +
-  * SQLite3 +
-  * GDAL +
-  * GRASS +
-</​file>​ +
-++++ +
- +
-For **Linux users**: ​Install QGIS and GRASS following [[http://​qgis.org/​en/​site/​forusers/​alldownloads.html#Linux|these instructions.]]+
  
 ===== 2 - Resources ===== ===== 2 - Resources =====
Line 79: Line 44:
 ==== Portals for downloading data ====  ==== Portals for downloading data ==== 
  
-  * [[http://​geobase.ca|Geobase (SITE CLOSED)]] 
   * [[http://​open.canada.ca/​data/​en/​dataset|Canada'​s open data portal]].   * [[http://​open.canada.ca/​data/​en/​dataset|Canada'​s open data portal]].
-  * [[http://geogratis.cgdi.gc.ca/|Geogratis.]]+  * [[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 94: 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 101: 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 118: Line 76:
 **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.** ​ **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.** ​
  
-**Step 1**: Install and activate the OpenLayers Python plugin from Plugins>​Manage and Install Plugins>​Get More +**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. 
-++++ If that isn't working for you| Add this URL (name it OpenLayers) to the list of repositories : http://​build.sourcepole.ch/​qgis/​plugins.xml , close the python plugins and try to enable the OpenLayers plugin 0.9.3 plugin.  +
-++++ +
-**Step 2**: 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. +
 <​file>​ <​file>​
 ID,​Name,​Long,​Lat ID,​Name,​Long,​Lat
Line 127: 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 ​3**: Add a Google ​Satellite ​layer using the Openlayers ​plugin ​(Web>OpenLayers plugin>)Note that the CRS of the map canvas changes to Google ​Mercator (WGS 84 / Pseudo mercator) when the layer is added. ​ Move this layer to the bottom of the maps canvas ​by clicking on it in the list of layers on the left and dragging it below the other layer+**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 packThen, add the Google ​Hybrid ​layer to the canvas ​from the web>​QuickMapServices menu
  
-**Step ​4**: To digitize the two reserves, you need to add 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). Press OK and give the shapefile layer an appropriate name (ex. McGill_Reserves.shp). 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 areasuse the points which you imported from the CSV file. For the Molson Reservedigitize the forested area located between the residential street (BlvdPerrot) 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 hectaresNow 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 ​2 alternative**: Add Google Satellite ​layer by clicking on the Browser>​XYZ tiles, right-click ​and select New connectionFor the namespecify Google Satellite. For the URLput 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 listYou can find other sources of tiles here (https://​leaflet-extras.github.io/​leaflet-providers/​preview/​)
  
-**Step ​5**: When done, exit Edit mode and save the layer+**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 ​6**: Start a new projectand set the CRS to NAD 83/UTM zone 18N. +**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 ​7**: Add your new reserves shapefile ​to this project+**Step ​5**: When done, exit Edit mode (click on pencil icon) and choose ​to save the layer
  
-**Step ​8**: 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 ​9**: 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 composer ​(>​Project>​New Print Composer), 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 Composer, you are presented with an empty page. To add the map, you need to click on the Add New Map canvas ​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. 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 "Adds 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 149: Line 104:
 **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 163: Line 118:
 **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'​ function 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 of the Jacques-Cartier district within the buffer. 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 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:
Line 173: Line 128:
 </​code>​ </​code>​
  
-**Step 11**: Use the 'Basic Statistics'​ (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 196: Line 151:
 **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 212: Line 167:
 **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. ​
Line 231: Line 186:
   * 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 [[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.
   * 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 Boundaries. The shapefile of interest is the one that ends with _MODIFIED ​+  * On Open Government website, download the shapefile of Aboriginal Lands of Canada Legislative Boundaries ​(al_ta_ca_shp_gdm_en.zip). The shapefile of interest is the one that ends with _MODIFIED ​
   * 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. ​
-  * 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. ​   * Using the latitude, longitude coordinates,​ add the GBIF occurences to the map canvas. ​
 +  * Merge the elevation raster layers (.tif) into one using Raster>​Miscellaneous>​Merge. Save the output as a .tif file. 
   * 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 243: Line 198:
 **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 261: Line 216:
 **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 299: Line 252:
  
 **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 7. Click on the "Use region of this map" icon beside layer A. In the formula box, type **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 7. Click 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="​distance_nowater=((region_hydrique-1)*-1)*distance_routes" ​
 </​file>​ </​file>​
- +(change ​the layer names accordingly)
-and give a name to the output file. +
  
 **Step 10**: To exclude areas closer than 1km from roads, create a text file (in text edit or Notepad) with the following content: ​ **Step 10**: To exclude areas closer than 1km from roads, create a text file (in text edit or Notepad) with the following content: ​
Line 321: Line 274:
 **Step 14**: Identify the patch with the largest area. Find the GRASS Shell in the list of functions and write the following command: ​ **Step 14**: Identify the patch with the largest area. Find the GRASS Shell in the list of functions and write the following command: ​
 <​file>​ <​file>​
-r.mapcalc "​Largest_patch=if(Step_12 ​ == ID, 1, null())" ​+r.mapcalc ​expression="​Largest_patch=if(Step_12 ​ == ID, 1, null())" ​
 </​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, 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.
  
-**Step 15**: Convert this file to vector by using the r.to.vect.area function. ​+**Step 15**: Convert this file to vector by using the r.to.vect.area function ​and add it to the canvas
 ====== GRASS Terminology====== ====== GRASS Terminology======
  
Line 344: Line 297:
  
  
-**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.]]**