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
onlinegis [2021/11/11 17:48]
elijah formatting file extensions and menu navigation to stand out.
onlinegis [2025/03/11 15:56] (current)
qcbs [1 - Installation of QGIS and GRASS]
Line 1: Line 1:
-======= Introduction to Open Source Geographic ​information systems ​with QGIS =======+======= Introduction to Open Source Geographic ​Information Systems ​with QGIS =======
  
  
Line 6: Line 6:
 Guillaume Larocque, Research Professional. ([email protected]) Guillaume Larocque, Research Professional. ([email protected])
  
-October 27-28 2021. Online. ​+March 2025. Online. ​
  
 ==== Presentation ==== ==== Presentation ====
Line 13: Line 13:
 ===== 1 - Installation of QGIS and GRASS ===== ===== 1 - Installation of QGIS and GRASS =====
  
-QGIS 3.20 will be used for this workshop. ​Please make sure that you have the appropriate versions installed prior to the workshop. The standalone installation is less complicated than the OSGeo4W Network Installer. If you only need QGIS (i.e. for this workshop), you may want to select that instead of OSGeo4W which is [[https://​www.osgeo.org/​projects/​osgeo4w/​|a set of open source geospatial software for Windows]].+Please make sure that you have the appropriate versions installed prior to the workshop. The standalone installation is less complicated than the OSGeo4W Network Installer. If you only need QGIS (i.e. for this workshop), you may want to select that instead of OSGeo4W which is [[https://​www.osgeo.org/​projects/​osgeo4w/​|a set of open source geospatial software for Windows]].
  
 Install QGIS following [[https://​qgis.org/​en/​site/​forusers/​download.html|these instructions.]] Install QGIS following [[https://​qgis.org/​en/​site/​forusers/​download.html|these instructions.]]
Line 24: Line 24:
 ==== QGIS ==== ==== QGIS ====
  
-  * **[[https://​docs.qgis.org/​3.10/​en/​docs/​user_manual/​index.html|The QGIS user guide]]**. +  * **[[https://​docs.qgis.org/​3.34/​en/​docs/​user_manual/​index.html|The QGIS user guide]]**. 
-  * **[[https://​docs.qgis.org/​3.10/​en/​docs/​training_manual/​index.html|The QGIS Training Manual]]**. Comprehensive online guide to QGIS with detailed tutorials. A book version of this manual is [[https://​locatepress.com/​qtm|also available]].+  * **[[https://​docs.qgis.org/​3.34/​en/​docs/​training_manual/​index.html|The QGIS Training Manual]]**. Comprehensive online guide to QGIS with detailed tutorials. A book version of this manual is [[https://​locatepress.com/​qtm|also available]].
   * [[http://​www.qgistutorials.com/​en/​|QGIS Tutorials and Tips]] by Ujaval Gandhi.   * [[http://​www.qgistutorials.com/​en/​|QGIS Tutorials and Tips]] by Ujaval Gandhi.
   * **[[https://​www.qgis.org/​en/​site/​forusers/​books/​index.html|Books on QGIS]]** List of recent books on using QGIS.    * **[[https://​www.qgis.org/​en/​site/​forusers/​books/​index.html|Books on QGIS]]** List of recent books on using QGIS. 
Line 101: Line 101:
 Move this background layer to the bottom in the Layers list by clicking on it and dragging it below your previous point layer. You can find other sources of tiles here (https://​leaflet-extras.github.io/​leaflet-providers/​preview/​) Move this background layer to the bottom in the Layers list by clicking on it and dragging it below your previous point layer. You can find other sources of tiles here (https://​leaflet-extras.github.io/​leaflet-providers/​preview/​)
  
-**Step 3**: To digitize the two reserves, you need to add a new empty polygon layer (''>​Layer >Create Layer >​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''​.+**Step 3**: To digitize the two reserves, you need to add a new empty polygon layer (''>​Layer >Create Layer >New Geopackage layer''​). Specify the CRS as NAD 83/UTM zone 18N and polygon as the geometry type. A column/​attribute for ID (integer) is already specified, add one for Name (Text data) by specifying a Name in the 'New field' section and clicking Add to fields list. Give the new Geopackage database an appropriate name (ex. mtl_region) and make sure it's in a appropriate folder on your computer by clicking on the ''​...''​ menu. Specify ​an appropriate name for the layer as well (ex. McGill_Reserves). Click OK and Enable Edit mode by left-clicking on the layer name in the left menu and selecting ''​Toggle Editing''​.
  
 **Step 4**: Digitize the McGill Molson Reserve and the Morgan Arboretum from the satellite image. To help you locate those areas, use the points which you imported from the ''​.csv''​ file. For the Molson Reserve, digitize the forested area located between the residential street (Blvd. Perrot) and highway 20 by clicking on the digitize icon: {{:​capture_du_2013-09-25_10_58_40.png?​nolink&​40|}}. For the Arboretum, digitize the contiguous forested area surrounding the point. The Arboretum is approximately 250 hectares. ​ **Step 4**: Digitize the McGill Molson Reserve and the Morgan Arboretum from the satellite image. To help you locate those areas, use the points which you imported from the ''​.csv''​ file. For the Molson Reserve, digitize the forested area located between the residential street (Blvd. Perrot) and highway 20 by clicking on the digitize icon: {{:​capture_du_2013-09-25_10_58_40.png?​nolink&​40|}}. For the Arboretum, digitize the contiguous forested area surrounding the point. The Arboretum is approximately 250 hectares. ​
  
-**Step 5**: Now add polygons adjacent to those polygons ​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 Snapping toolbar under ''>​View >​Toolbar''​. ​+**Step 5**: Now add polygons adjacent to those polygons ​corresponding to what you propose as extensions to the existing reserves. For two adjacent polygons to properly share a common boundary, you need to digitize the second polygon so as to make it overlap slightly the first one. For this to work, it is important to enable snapping by clicking on the red magnet icon and setting an appropriate snapping tolerance (ex 20 meters). If you don't see the snapping options toolbar, enable the Snapping toolbar under ''>​View >​Toolbar''​. ​
  
 **Step 6**: When done, exit Edit mode (click on pencil icon) and choose to save the layer. ​ **Step 6**: When done, exit Edit mode (click on pencil icon) and choose to save the layer. ​
Line 214: Line 214:
 ====== Extra exercise 1 - Manipulation of rasters and intro to satellite imagery ====== ====== Extra exercise 1 - Manipulation of rasters and intro to satellite imagery ======
  
-**Objective:​ create an RGB false color composite image and an NDVI (Normalized Difference Vegetation Index) map, associate it with a color palette and extract the mean NDVI for parcs and fields of the region. Find which park is least vegetated** ​+**Objective:​ create an RGB false color composite image and an NDVI (Normalized Difference Vegetation Index) map, associate it with a color palette and extract the mean NDVI for parks and fields of the region. Find which park is least vegetated.** 
  
-**Step 1**: We will first create a false-color composite image to better visualize the contrasts. To do so, find the merge function under Raster>​Miscellaneous. Choose Landsat images 4,3 and 2 (you might need to click on them in that order, depending on your operating system) as the input files, specify Landsat_432.tif as the Output, and select "Put each input file into a separate band" option. In the Symbologie properties ​of the new layer, the Landsat band 4 should become band 1 (Red), Landsat band 3 should become band 2 (Green) and Landsat band 2 should become band 3 (Blue). Yes, this is confusing. ​+**Step 1**: We will first create a false-color composite image to better visualize the contrasts. To do so, find the merge function under ''>​Raster >​Miscellaneous''​. Choose Landsat images 4,3 and 2 (you might need to click on them in that order, depending on your operating system) as the input files, specify Landsat_432.tif as the output, and select "Put each input file into a separate band" option. In the Symbology Properties ​of the new layer, the Landsat band 4 should become band 1 (Red), Landsat band 3 should become band 2 (Green) and Landsat band 2 should become band 3 (Blue). ​(Yes, this is confusing.)
  
 **Step 2**: In the Symbology section, you'll notice that "​Multiband color" is used as the Render type. You can play with the brightness, contrast and saturation to improve the visual appearance of the image. Notice how this image can easily allow you to distinguish the vegetation, suburbs, cities and rivers. You can also create a 5-4-3 composite and compare the two images. **Step 2**: In the Symbology section, you'll notice that "​Multiband color" is used as the Render type. You can play with the brightness, contrast and saturation to improve the visual appearance of the image. Notice how this image can easily allow you to distinguish the vegetation, suburbs, cities and rivers. You can also create a 5-4-3 composite and compare the two images.
Line 232: Line 232:
 **Step 4**: In the properties menu of that layer, select Single band pseudo color as the Render type, choose the RdYlGn color map and click on Classify. On this map, dark green areas represent areas that are densely vegetated while reddish areas are not vegetated. ​ **Step 4**: In the properties menu of that layer, select Single band pseudo color as the Render type, choose the RdYlGn color map and click on Classify. On this map, dark green areas represent areas that are densely vegetated while reddish areas are not vegetated. ​
  
-**Step 5**: Add the layer containing the parcs and fields (parcs_terrains_sports.shp) to the canvas and save it as a new file with the CRS NAD83 / UTM 18N. Add the new file to the canvas and remove the old one. +**Step 5**: Add the layer containing the parks and fields (parcs_terrains_sports.shp) to the canvas and save it as a new file with the CRS NAD83 / UTM 18N. Add the new file to the canvas and remove the old one. 
  
-**Step 6**: Find the Zonal statistics menu in the Procesing Toobox. Choose the parcs et terrains as the vector layer and the NDVI image as the raster layer. ​+**Step 6**: Find the Zonal Statistics entry in the Processing Toolbox. Choose the 'parcs et terrains' ​as the vector layer and the NDVI image as the raster layer. ​
  
-**Step 7**: By looking at the attribute table of the parcs et terrains layer, you will see that columns were added with the statistics of the NDVI cells for each field and park. Which park has the the lowest Mean NDVI (click on the column name to sort)? Where is it located (Click on the zoom to selection icon)?+**Step 7**: By looking at the attribute table of the 'parcs et terrains' ​layer, you will see that columns were added with the statistics of the NDVI cells for each field and park. Which park has the the lowest Mean NDVI (click on the column name to sort)? Where is it located (Click on the zoom to selection icon)?
  
 ++++ Answer | ++++ Answer |
  
-The park is located North of autoroute 40 in Ville Saint-Laurent (number 305, mean ndvi: -0.31). If you add a Google satellite layer to the canvas, you will note that there are no parks at that location, explaining the very low NDVI value.  ​+The park is located North of autoroute 40 in Ville Saint-Laurent (number 305, mean NDVI: -0.31). If you add a Google satellite layer to the canvas, you will note that there are no parks at that location, explaining the very low NDVI value.  ​
  
 ++++ ++++
  
 **CHALLENGE**:​ **CHALLENGE**:​
-Go to the USGS EarthExplorer website [[http://​earthexplorer.usgs.gov/​]] and create an account by clicking on register. Then, choose a region anywhere in the world about the size of the Montreal region that you think could have seen a lot of land use change in the last 30 years. Search for a  Landsat 4-5TM (Collection 1 Level 1) image dating anywhere between 1980-1990 for that region and taken in the summer months that contains less than 20% clouds. Download that file as a Level 1 product. Note the path/row information of this image and search for an equivalent image for 2010-2015 (same months, row and path). Bring them to QGIS, and calculate an NDVI value for each time period. ​Substract ​the later NDVI from the earlier NDVI and view the file with {{:​ndvidiff.qml|this palette}} (right-click the link...save as) to see the difference in vegetation cover between the two time periods. ​+Go to the USGS EarthExplorer website [[http://​earthexplorer.usgs.gov/​]] and create an account by clicking on register. Then, choose a region anywhere in the world about the size of the Montreal region that you think could have seen a lot of land use change in the last 30 years. Search for a  Landsat 4-5TM (Collection 1 Level 1) image dating anywhere between 1980-1990 for that region and taken in the summer months that contains less than 20% clouds. Download that file as a Level 1 product. Note the path/row information of this image and search for an equivalent image for 2010-2015 (same months, row and path). Bring them to QGIS, and calculate an NDVI value for each time period. ​Subtract ​the later NDVI from the earlier NDVI and view the file with {{:​ndvidiff.qml|this palette}} (right-click the link... ​''​Save ​as''​) to see the difference in vegetation cover between the two time periods. ​
  
 **CHALLENGE 2** **CHALLENGE 2**
-Use the Cluster Analysis for Grids function in Processing Toolbox>​SAGA to perform an unsupervised classification of your images using bands 3,4,5 and 7. +Use the Cluster Analysis for Grids function in ''>​Processing Toolbox >SAGA'' ​to perform an unsupervised classification of your images using bands 3,4,5 and 7. 
  
 ====== Extra exercise 2 - Using GRASS with QGIS Processing toolbox ====== ====== Extra exercise 2 - Using GRASS with QGIS Processing toolbox ======