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
osgis [2012/12/04 12:46]
glaroc
osgis [2013/11/27 11:27] (current)
glaroc [**THIS PAGE WAS DONE FOR AN OLDER VERSION OF THE WORKSHOP [[introgis|CLICK HERE FOR THE CURRENT VERSION]]**]
Line 6: Line 6:
 Guillaume Larocque, Research Professional. (guillaume.larocque@mcgill.ca) Guillaume Larocque, Research Professional. (guillaume.larocque@mcgill.ca)
  
-November 2012+====== **THIS PAGE WAS DONE FOR AN OLDER VERSION OF THE WORKSHOP ** ====== 
 +[[introgis|CLICK HERE FOR THE CURRENT VERSION]]
  
 ===== Presentation ===== ===== Presentation =====
 [[http://​prezi.com/​6r27xo6lwebg/​introduction-to-open-source-gis-with-qgis-and-grass/​|Link to presentation on Prezi]] [[http://​prezi.com/​6r27xo6lwebg/​introduction-to-open-source-gis-with-qgis-and-grass/​|Link to presentation on Prezi]]
  
-[[http://​prezi.com/​6r27xo6lwebg/​present/?​auth_key=29mip79&​follow=ktr6emnemif_&​kw=present-6r27xo6lwebg&​rc=ref-19631691|Link for simultaneous presentation on Prezi]]+[[http://​prezi.com/​6r27xo6lwebg/​present/?​auth_key=slujiph&​follow=ktr6emnemif_&​kw=present-6r27xo6lwebg&​rc=ref-19631691|Link for simultaneous presentation on Prezi]]
  
 ===== 1 - Installation of QGIS and GRASS ===== ===== 1 - Installation of QGIS and GRASS =====
Line 201: Line 202:
 Step 1: Start a new project. Step 1: Start a new project.
  
-Step 2: Add the CSV file named '​BBS_Routes_QC.csv'​ to the map canvas using the function 'Add delimited text layer' (Choose '​Selected delimiters'​->​comma) and specify the CRS WGS84 (Latitude, Longitude - Geographic)+Step 2: Add the CSV file named '​BBS_Routes_QC.csv'​ to the map canvas using the function 'Add delimited text layer' (Choose '​Selected delimiters'​->​comma) and specify the CRS WGS84 (Geographic)
  
 Step 3: Save this layer as a shapefile named '​BBS_Routes_QC.shp'​ with the CRS: NAD83 / Quebec Lambert. Step 3: Save this layer as a shapefile named '​BBS_Routes_QC.shp'​ with the CRS: NAD83 / Quebec Lambert.
Line 211: Line 212:
 Step 6: Add the (non-spatial) table '​BBS_Ovenbird_QC.csv'​ to the canvas using '​Layers>​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 Vector Layer' and by listing all the file types (yes, this is counterintuitive...)
  
-Step 7: 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'​. You should now see the number of ovenbird observations per year in the attribute table of the '​BBS_Routes_QC'​ file. +Step 7: 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). You should now see the number of ovenbird observations per year in the attribute table of the '​BBS_Routes_QC'​ file. 
  
-Step 8: Activate the editing mode and use the 'Field Calculator'​ to add a new column (integer) to the table BBS_Routes containing the sum of the number of bird observations between 1980-1994 and 1995-2012. Each field has to be selected one by one from the Fields and Values list (sorry). ​+Step 8: Activate the editing mode and use the 'Field Calculator'​ to add a new column (integer) to the table BBS_Routes containing the sum of the number of bird observations between 1980-1994 and 1995-2012. Each field has to be selected one by one from the Fields and Values list (sorry). ​**The data type should be integer (length 10 or more). Column names should have less than 10 characters, should start with a letter and should contain no spaces or special characters**
  
-Step 9: Save the changes and exit the editing mode. Note that only the new columns that were created are really part of the BBS_Routes_QC. ​The yearly observations ​can be removed by removing ​the join+Step 9: Save the changes and exit editing mode. Note that only the new columns that were created are really part of the BBS_Routes_QC ​tableNow 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: Make sure that the GRASS extension is activated and that the GRASS icons bar is selected in >​View>​Toolbar,​ and that it is not hidden somewhere in your icons bar. Click on the New mapset icon and define a new GRASS Database, a new Location (name it workshop2), choose the CRS NAD83 / Quebec Lambert, specify the default GRASS Region by using the current QGIS extent and specify a name for the Mapset. ​ Step 10: Make sure that the GRASS extension is activated and that the GRASS icons bar is selected in >​View>​Toolbar,​ and that it is not hidden somewhere in your icons bar. Click on the New mapset icon and define a new GRASS Database, a new Location (name it workshop2), choose the CRS NAD83 / Quebec Lambert, specify the default GRASS Region by using the current QGIS extent and specify a name for the Mapset. ​
Line 221: Line 222:
 Step 11: You now need to import the files into GRASS. Click on 'Open GRASS tools',​ click on the '​Module tree'>'​File management'>'​Import into GRASS'>'​Import a vector into GRASS'>'​v.in.ogr.qgis'​. Select the file BBS_Routes_QC.shp and specify a name for the output file. Add the newly created GRASS file to the map canvas by clicking on the 'Add Grass vector layer' icon.  Step 11: You now need to import the files into GRASS. Click on 'Open GRASS tools',​ click on the '​Module tree'>'​File management'>'​Import into GRASS'>'​Import a vector into GRASS'>'​v.in.ogr.qgis'​. Select the file BBS_Routes_QC.shp and specify a name for the output file. Add the newly created GRASS file to the map canvas by clicking on the 'Add Grass vector layer' icon. 
  
-Step 12: Click on '​Display current GRASS region'​ and on 'Edit current GRASS region'​. You need to define the properties of the current GRASS region to obtain a resolution of 2km x 2km *exactly* so that you can include most the points (you can exclude points in Northern Quebec), but without extending too much outside of the extent ​of the points. Don't hesitate to use a calculator and the image below: ​+Step 12: Click on '​Display current GRASS region'​ and on 'Edit current GRASS region'​. You need to define the properties of the current GRASS region to obtain 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 13: Convert the Quebec province file into GRASS format. ​+Step 13: Convert the Quebec province file into GRASS format ​(same as Step 11)
  
 Step 14: Find the v.to.rast.constant GRASS function and convert the Quebec polygon to raster (use 1 as Raster value). This will have the extents and resolution specified in Step 12.  Step 14: Find the v.to.rast.constant GRASS function and convert the Quebec polygon to raster (use 1 as Raster value). This will have the extents and resolution specified in Step 12. 
  
-Step 15: Use the r.mask function to create a mask with the raster created in Step 14. +Step 15: Use the r.mask ​GRASS function to create a mask with the raster created in Step 14. Add this new raster map to your canvas using 'Add GRASS raster layer'
  
-Step 16: Find the module v.surf.idw in the GRASS toolbox, choose a name for the output file and interpolate a map for the data from 1980-1994 and another for the 1995-2005 data. You need to select the appropriate columns in the attribute field. ​+Step 16: Find the module v.surf.rst GRASS function, choose a name for the output file and interpolate a map for the data from 1980-1994 and another for the 1995-2005 data. You need to select the appropriate columns in the attribute field. Add these GRASS rasters to your map canvas. You will see that these maps will have the proper resolution (Step 12) and the interpolation will be limited by the mask (Step 15)
  
 Step 17: In the properties of each layer, develop a new color palette appropriate for these files (Tab Style>​Color palette>​Color palette and then click on the tab >​Colormap). Choose a linear color interpolation,​ 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) and assign the same palette to rasters from each period. Do you notice any difference in the spatial distribution of the ovenbirds over time? Step 17: In the properties of each layer, develop a new color palette appropriate for these files (Tab Style>​Color palette>​Color palette and then click on the tab >​Colormap). Choose a linear color interpolation,​ 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) and assign the same palette to rasters from each period. Do you notice any difference in the spatial distribution of the ovenbirds over time?
Line 245: Line 246:
 **Objective:​ create a NDVI (Normalized Difference Vegetation Index) map, associate it with a color palette and extract the mean NDVI for parcs and fields of the region.** ​ **Objective:​ create a NDVI (Normalized Difference Vegetation Index) map, associate it with a color palette and extract the mean NDVI for parcs and fields of the region.** ​
  
-Step 1: Within QGIS: Add the parcs_terrains_sports.shp layer to the canvas and save it as a new file with the CRS NAD83 / UTM 18N. Convert the file to GRASS format using the v.in.ogr.qgis function. If the operation was completed successfully,​ you can now close QGIS. +Step 1: Within QGIS: Add the parcs_terrains_sports.shp layer to the canvas and save it as a new file with the CRS NAD83 / UTM 18N. Open the mapset '​landsat'​ from the 'Day 2' Database folder extracted from the zip file. Convert the file to GRASS format using the v.in.ogr.qgis function. If the operation was completed successfully,​ you can now close QGIS. 
  
 Step 2: Open GRASS. On the '​Welcome to GRASS' interface, Browse to select the GIS Data directory and select the folder named Day 2 that you have extracted from the downloaded zip file. The project should be set to '​31h05'​ and the mapset to '​Landsat'​. ​ Step 2: Open GRASS. On the '​Welcome to GRASS' interface, Browse to select the GIS Data directory and select the folder named Day 2 that you have extracted from the downloaded zip file. The project should be set to '​31h05'​ and the mapset to '​Landsat'​. ​
Line 270: Line 271:
 **Objective:​ Create a 3D visualization showing a composite RGB map superimposed on an elevation surface.** ​ **Objective:​ Create a 3D visualization showing a composite RGB map superimposed on an elevation surface.** ​
  
-Step 1: Select Raster>​Generate colors>Manage colors>​Create RGB. You will now create an RGB composite file by using the following band associations:​ Red:4 Green:3 Blue:​2. ​+Step 1: Select Raster>​Manage colors>​Create RGB. You will now create an RGB composite file by using the following band associations:​ Red:4 Green:3 Blue:​2. ​
  
 Step 2: In Files>​NVIZ,​ create a 3D visualization with the file 31H05_dem as the elevation file and the RGB composite you just created (leave the other fieds blank). To improve the display resolution, click on Visualize>​Raster Surface and specify 1 as the fine resolution. ​ Step 2: In Files>​NVIZ,​ create a 3D visualization with the file 31H05_dem as the elevation file and the RGB composite you just created (leave the other fieds blank). To improve the display resolution, click on Visualize>​Raster Surface and specify 1 as the fine resolution. ​