Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
onlinegis [2021/11/11 17:45] 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 198: | Line 198: | ||
| **CHALLENGE 2**: Regenerate your interpolated raster maps for each time periods using the Multi-level B-Spline Interpolation tool in Saga. Use the Processing toolbox for this. Compare those maps with the ones you obtained with Inverse Distance Weighting. | **CHALLENGE 2**: Regenerate your interpolated raster maps for each time periods using the Multi-level B-Spline Interpolation tool in Saga. Use the Processing toolbox for this. Compare those maps with the ones you obtained with Inverse Distance Weighting. | ||
| - | ====== Exercice 4 - Downloading files, recap and challenge! ====== | + | ====== Exercise 4 - Downloading files, recap and challenge! ====== |
| - | For this exercise, you will need to extract the mean elevation and the land cover at occurence sites of the [[http://www.gbif.org/|Global Biodiversity Information Facility (GBIF)]] falling within the Wemindji aboriginal territory, in the James Bay area of Quebec. **You will want to work with the UTM Zone 17N / NAD83 reference system**. Note that to reproject a raster, the preferred way is to use Raster>Projections>Warp. To achieve the objective, you will need to complete the following steps: | + | For this exercise, you will need to extract the mean elevation and the land cover at occurrence sites of the [[http://www.gbif.org/|Global Biodiversity Information Facility (GBIF)]] falling within the Wemindji aboriginal territory, in the James Bay area of Quebec. **You will want to work with the UTM Zone 17N / NAD83 reference system**. Note that to reproject a raster, the preferred way is to use ''>Raster >Projections >Warp''. To achieve the objective, you will need to complete the following steps: |
| * On the [[https://open.canada.ca/en/open-data|Canada Open Government]] website, download raster [[http://ftp.geogratis.gc.ca/pub/nrcan_rncan/elevation/cdem_mnec/|elevation files]] for zones 33D and 33E at the 1:250,000 scale. | * On the [[https://open.canada.ca/en/open-data|Canada Open Government]] website, download raster [[http://ftp.geogratis.gc.ca/pub/nrcan_rncan/elevation/cdem_mnec/|elevation files]] for zones 33D and 33E at the 1:250,000 scale. | ||
| - | * Download this {{::qc_land_use_33de.zip|ZIP package}} containing a tif file with a recent land cover classification of the area and the associated style/colormap in qml format. | + | * Download this {{::qc_land_use_33de.zip|ZIP package}} containing a ''.tif'' file with a recent land cover classification of the area and the associated style/colormap in ''.qml'' format. |
| * On the MERN website (https://mern.gouv.qc.ca/territoire/portrait/portrait-donnees-mille.jsp), download the "Découpages administratifs", "Municipalités, TNO et territoires autochtones" dataset as a shapefile. You will want the polygon layer. | * On the MERN website (https://mern.gouv.qc.ca/territoire/portrait/portrait-donnees-mille.jsp), download the "Découpages administratifs", "Municipalités, TNO et territoires autochtones" dataset as a shapefile. You will want the polygon layer. | ||
| - | * Download {{::occurrence.txt|this file}} containing the [[http://www.gbif.org/|GBIF]] species occurences in the Wemindji region. Note that this file is TAB delimited and the coordinates are in Latitude, longitude (WGS84). You can open it in a text editor to explore it's content. | + | * Download {{::occurrence.txt|this file}} containing the [[http://www.gbif.org/|GBIF]] species occurrences in the Wemindji region. Note that this file is TAB delimited and the coordinates are in Latitude, longitude (WGS84). You can open it in a text editor to explore it's content. |
| - | * Using the latitude, longitude coordinates, add the GBIF occurences to the map canvas (it is TAB delimited). | + | * Using the latitude, longitude coordinates, add the GBIF occurrences to the map canvas (it is TAB delimited). |
| - | * Merge the elevation raster layers (.tif) into one using Raster>Miscellaneous>Merge. Save the output as a .tif file. | + | * Merge the elevation raster layers (''.tif'') into one using ''>Raster >Miscellaneous >Merge''. Save the output as a ''.tif'' file. |
| * Use a filter to isolate the Wemindji territory (MUS_MN_MUN column)from the municipalities layer. | * Use a filter to isolate the Wemindji territory (MUS_MN_MUN column)from the municipalities layer. | ||
| * Clip the occurrences to obtain only those within the Wemindji territory. | * Clip the occurrences to obtain only those within the Wemindji territory. | ||
| - | * Use the 'point sampling tool' plugin to extract the name of each species in latin, the land cover and the elevation at each occurrence location. Note that some locations contain a large number of occurrences. | + | * Use the 'point sampling tool' plugin to extract the name of each species in Latin, the land cover and the elevation at each occurrence location. //Note: some locations contain a large number of occurrences.// |
| **CHALLENGE**: Use the Kernel Density Estimation tool in SAGA (Processing toolbox) to obtain a raster showing the density of all bird occurrences in the GBIF occurrence data provided. | **CHALLENGE**: Use the Kernel Density Estimation tool in SAGA (Processing toolbox) to obtain a raster showing the density of all bird occurrences in the GBIF occurrence data provided. | ||
| ====== 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 ====== | ||
