# Differences

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

 introgis [2018/10/22 11:50]qcbs [Exercise 1 - Digitizing and map display] introgis [2019/11/12 17:17] (current)qcbs [Exercice 4 - Downloading files, recap and challenge!] 2019/11/12 17:17 qcbs [Exercice 4 - Downloading files, recap and challenge!] 2019/11/12 17:15 qcbs [Exercise 6 - Using GRASS with QGIS Processing toolbox] 2019/11/12 17:14 qcbs [Exercise 6 - Using GRASS within QGIS Processing toolbox] 2019/11/12 17:10 qcbs [Exercice 4 - Downloading files, recap and challenge!] 2019/11/11 16:52 qcbs [Exercice 4 - Downloading files, recap and challenge!] 2019/11/11 16:45 qcbs [Exercise 6 - Using GRASS within QGIS] 2019/11/11 14:46 qcbs [Exercise 1 - Digitizing and map display] 2019/11/11 14:26 qcbs [Exercise 1 - Digitizing and map display] 2019/11/11 13:27 qcbs [Introduction to Open Source Geographic information systems with QGIS and GRASS] 2018/10/23 15:37 qcbs [Exercise 2 - Buffers and basic analyses] 2018/10/22 17:07 qcbs [3 - Open Source GIS software] 2018/10/22 16:18 qcbs [Exercice 3 - Interpolation and raster manipulation with QGIS] 2018/10/22 16:17 qcbs [Exercise 6 - Using GRASS within QGIS] 2018/10/22 13:38 qcbs [Exercise 1 - Digitizing and map display] 2018/10/22 13:31 qcbs [Exercise 1 - Digitizing and map display] 2018/10/22 12:15 qcbs [Exercise 6 - Using GRASS within QGIS] 2018/10/22 12:10 qcbs [Exercice 3 - Interpolation and raster manipulation with QGIS] 2018/10/22 12:04 qcbs [Exercise 2 - Buffers and basic analyses] 2018/10/22 11:50 qcbs [Exercise 1 - Digitizing and map display] 2018/10/22 11:24 qcbs [5 - Exercises] 2018/10/22 11:24 qcbs [4 - Getting started] 2018/10/19 15:14 qcbs [GRASS Terminology] 2018/10/19 15:13 qcbs [Exercise 6 - Using GRASS within QGIS] 2018/10/19 15:12 qcbs [Exercise 6 - Using GRASS within QGIS] 2018/10/19 14:47 qcbs [Exercise 5 - Manipulation of rasters and intro to satellite imagery] 2018/10/19 14:06 qcbs [Exercice 4 - Downloading files, recap and challenge!] 2018/10/19 13:53 qcbs [Exercice 3 - Interpolation and raster manipulation with QGIS] 2018/10/19 13:52 qcbs [Exercice 3 - Interpolation and raster manipulation with QGIS] 2018/10/19 13:38 qcbs [Exercise 2 - Buffers and basic analyses] 2018/10/19 13:21 qcbs [Exercise 1 - Digitizing and map display] 2018/10/19 13:09 qcbs [Exercise 1 - Digitizing and map display] 2018/10/19 12:02 qcbs [Introduction to Open Source Geographic information systems with QGIS and GRASS] 2018/10/18 16:05 qcbs [Portals for downloading data] 2018/10/18 16:05 qcbs [1 - Installation of QGIS and GRASS] 2017/11/24 10:54 qcbs [Exercice 3 - Interpolation and raster manipulation with QGIS] 2017/11/22 16:23 qcbs [Exercise 5 - Manipulation of rasters and intro to satellite imagery] 2017/11/22 16:19 qcbs [Download files needed for exercises] 2017/11/22 16:19 qcbs [Introduction to Open Source Geographic information systems with QGIS and GRASS] 2017/11/22 16:18 qcbs [Presentation] 2017/11/22 14:23 qcbs [Exercice 4 - Downloading files, recap and challenge!] 2017/11/22 13:55 qcbs [Exercice 4 - Downloading files, recap and challenge!] 2017/11/22 13:53 qcbs [Exercice 4 - Downloading files, recap and challenge!] 2017/11/22 13:49 qcbs [Exercice 4 - Downloading files, recap and challenge!] 2017/11/22 13:49 qcbs [Exercice 4 - Downloading files, recap and challenge!] 2019/11/12 17:17 qcbs [Exercice 4 - Downloading files, recap and challenge!] 2019/11/12 17:15 qcbs [Exercise 6 - Using GRASS with QGIS Processing toolbox] 2019/11/12 17:14 qcbs [Exercise 6 - Using GRASS within QGIS Processing toolbox] 2019/11/12 17:10 qcbs [Exercice 4 - Downloading files, recap and challenge!] 2019/11/11 16:52 qcbs [Exercice 4 - Downloading files, recap and challenge!] 2019/11/11 16:45 qcbs [Exercise 6 - Using GRASS within QGIS] 2019/11/11 14:46 qcbs [Exercise 1 - Digitizing and map display] 2019/11/11 14:26 qcbs [Exercise 1 - Digitizing and map display] 2019/11/11 13:27 qcbs [Introduction to Open Source Geographic information systems with QGIS and GRASS] 2018/10/23 15:37 qcbs [Exercise 2 - Buffers and basic analyses] 2018/10/22 17:07 qcbs [3 - Open Source GIS software] 2018/10/22 16:18 qcbs [Exercice 3 - Interpolation and raster manipulation with QGIS] 2018/10/22 16:17 qcbs [Exercise 6 - Using GRASS within QGIS] 2018/10/22 13:38 qcbs [Exercise 1 - Digitizing and map display] 2018/10/22 13:31 qcbs [Exercise 1 - Digitizing and map display] 2018/10/22 12:15 qcbs [Exercise 6 - Using GRASS within QGIS] 2018/10/22 12:10 qcbs [Exercice 3 - Interpolation and raster manipulation with QGIS] 2018/10/22 12:04 qcbs [Exercise 2 - Buffers and basic analyses] 2018/10/22 11:50 qcbs [Exercise 1 - Digitizing and map display] 2018/10/22 11:24 qcbs [5 - Exercises] 2018/10/22 11:24 qcbs [4 - Getting started] 2018/10/19 15:14 qcbs [GRASS Terminology] 2018/10/19 15:13 qcbs [Exercise 6 - Using GRASS within QGIS] 2018/10/19 15:12 qcbs [Exercise 6 - Using GRASS within QGIS] 2018/10/19 14:47 qcbs [Exercise 5 - Manipulation of rasters and intro to satellite imagery] 2018/10/19 14:06 qcbs [Exercice 4 - Downloading files, recap and challenge!] 2018/10/19 13:53 qcbs [Exercice 3 - Interpolation and raster manipulation with QGIS] 2018/10/19 13:52 qcbs [Exercice 3 - Interpolation and raster manipulation with QGIS] 2018/10/19 13:38 qcbs [Exercise 2 - Buffers and basic analyses] 2018/10/19 13:21 qcbs [Exercise 1 - Digitizing and map display] 2018/10/19 13:09 qcbs [Exercise 1 - Digitizing and map display] 2018/10/19 12:02 qcbs [Introduction to Open Source Geographic information systems with QGIS and GRASS] 2018/10/18 16:05 qcbs [Portals for downloading data] 2018/10/18 16:05 qcbs [1 - Installation of QGIS and GRASS] 2017/11/24 10:54 qcbs [Exercice 3 - Interpolation and raster manipulation with QGIS] 2017/11/22 16:23 qcbs [Exercise 5 - Manipulation of rasters and intro to satellite imagery] 2017/11/22 16:19 qcbs [Download files needed for exercises] 2017/11/22 16:19 qcbs [Introduction to Open Source Geographic information systems with QGIS and GRASS] 2017/11/22 16:18 qcbs [Presentation] 2017/11/22 14:23 qcbs [Exercice 4 - Downloading files, recap and challenge!] 2017/11/22 13:55 qcbs [Exercice 4 - Downloading files, recap and challenge!] 2017/11/22 13:53 qcbs [Exercice 4 - Downloading files, recap and challenge!] 2017/11/22 13:49 qcbs [Exercice 4 - Downloading files, recap and challenge!] 2017/11/22 13:49 qcbs [Exercice 4 - Downloading files, recap and challenge!] 2017/11/22 13:41 qcbs [Exercice 4 - Downloading files, recap and challenge!] 2017/11/22 13:18 qcbs [Introduction to Open Source Geographic information systems with QGIS and GRASS] 2017/11/22 13:16 qcbs [Exercise 1 - Digitizing and map display] 2017/11/22 13:16 qcbs [Exercise 1 - Digitizing and map display] 2017/11/22 13:15 qcbs [Exercise 2 - Buffers and basic analyses] 2017/11/22 13:06 qcbs [Exercice 3 - Interpolation and raster manipulation with QGIS] 2017/11/22 12:45 qcbs [Exercise 5 - Manipulation of rasters and intro to satellite imagery] Line 6: Line 6: Guillaume Larocque, Research Professional. (guillaume.larocque@mcgill.ca) Guillaume Larocque, Research Professional. (guillaume.larocque@mcgill.ca) - October 23 and 24, 2018. McGill University + November 12 and 13, 2019. 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 83: Line 84: 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. ​ 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 New 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 + ​ + 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. Line 93: Line 101: **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 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 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. ​ + **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 101: 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 148: 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 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 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 4 to the canvas. ​ + **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 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 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 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 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 164: 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 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|}} Line 179: Line 187: **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 Boundaries (al_ta_ca_shp_gdm_en.zip). The 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. ​ + * 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. + * 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 228: 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 bar. Click 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 GRASS. Click on 'Open GRASS tools' (if the tab is not already active), click on the '​Module tree'>'​File management'>'​Import into GRASS'>'​Import ​a vector into GRASS'>'​v.in.ogr.qgis'​. Select ​the route file you created in step 2 and specify a name for the output file. Repeat 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 ​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 4**: Find the function called r.in.gdal and import the 31h05dem.tif file to GRASS. Add 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 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 7. Click on the "Use region of this map" icon beside layer A. In the formula box, type + + **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. <​file>​ <​file>​ - r.mapcalc ​"​distance_nowater=((region_hydrique-1)*-1)*distance_routes" ​ + r.mapcalc ​expression="((A-1)*-1)*B" ​ ​ - (change the layer names accordingly) - **Step ​10**: To exclude areas closer than 1km from roads, ​create a text file (in text edit or Notepad) ​with the following ​content: + **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: <​file>​ <​file>​ Line 263: Line 263: ​ - **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 ​file. You 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 count. Then, 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 = 1 + * = NULLL ​ - 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======