- Review from last week – DEM and Watersheds
- Data Management and creating “GeoDatabases”
- Rerun Watershed – save specific layers
- Clean up Creeks layer
- Create and move new features
- and more…
Review from Last Week
Last week we focused on Raster data and took a quick look at watershed derivation using GRASS (from the QGIS interface). We noticed the possibility of having may creeks in the area as a result of the terrain. This week we will combine vector and Raster data to work out the layout of a proposed new building for ENPL 303 students.
Data management and the use of so called “GeoDatabases”
Files and Folders
We need to start our lab out with a clean slate today and start organizing our work with some structure to it. Lets start out my ensuring our primary folder for working in the class called enpl303 (or something very similar) with no spaces. Once that is determined, create a new folder called site_layout. We will be working in that folder today (as well as the /home/labs/enpl303 and geog300 folders)
ESRI coined the phrase GeoDatabase, but as you know – you organized folders with shape files, KMZ, GPX, TIFF and other files counts and a database as well. If you are so inclined, open up ArcCatalog and navigate to the folder you just created. Right click on that folder or in the area –> new –> fle based geodatabase –> call it site_layout_data. If we have time we will it later in class.
If you navigate to the folder where you created the file GeoDatabase – you will notice that it is a folder itself with a .gdb extension.
QGIS and others
We are going to use Spatialite databases in QGIS today as a way to store and share our data. In order to create an empty one to work with:
- Layer –> Create New Layer –> New Spatialite Layer
- Use the image below as a template to create the databasecourses/enpl-303/labs/vectors-rasters-databases-site-work/
We will use this dataset shortly.
We will rerun the r.watershed processing tool using the same data as last week as follows:
- Load in /home/labs/enpl303/forest_for_the_world/all4_terrain_filled.tif file into your project
- run the r.watershed program again with the parameters in the image below and
- only save out files for the number of cells and half basin results
Also style you DTM with the hillshade style to see changes in the terrain easier
More data and grouping in the table of contents
Load in the same orthophotos we used last week (the are in the /home/data/pg_lidar_ortho_2014/Ortho2014 folder. Once they are loaded in select all of the layers in the TOC and group them. Name the group accordingly.
UNBC Vector data
Load in the lakes, wetlands, trails and roads from the /home/labs/geog300/unbc folder and the buildings from the /home/labs/geog300/unbc/campus_digitizing folder.
Load the creeks layer -> /home/labs/enpl303/site_layout/creeks.shp
Go back to the city of Prince George and get the Zoning_Bylaw_7850_Code and Zoning_Bylaw_7850_Class layers to add to the project later on. Where are you going to store them?
Save your project
Repair and test the creeks layer
Saving to a database
You will need to save the creeks layer as your own in order to digitize it. You can save it to the newly created database. Watch the following movie on how to do this:
Once digitized – remove the other creeks layer from the project
Now that you own the data – you can correct it. There is a break where lakes are near Shane Lake on this creeks layer. The above video showed Scott fixing part of them – but there are still errors..
The link below is another instruction video on digitizing.
Testing the water network
Load the plugin called road graph and test the flow from Shane Lake to the pit by Ginter’s.
- Plugins –> Road Graph
- Vector –> Road Graph –> settings –> choose metres –> creeks layer (the proper creeks layer)
- Go to the road graph interface –> start at the mouth of Shane lake –> end at the small pond down the hill
Save your project
Creating a new building
Create a new building by using another plugin for QGIS
- Plugins –> CADDigitize
- Create a new layer in your spatialite database –> new_bulding
- Open database manager –> high lite your database –> table –> create table as below
- Right click this new layer and add to canvas
Play with CADDigitize functions to draw a new building that just surrounds the eastern Teaching and Learning building. Once it is created do the follwing
- Move the building to an initial place of interest –> edit layer –> use the move feature button to add move functionality
- Create a second area for parking and access that surrounds the building BUT this area has to have a hole where your building is
Collect statistics from a buffered built up area
Once the building is placed in a suitable area, we will need to ensure the surrounding area is not impacted by the construction of the built up area. We will create a zone 100 metres around the building and parking areas and collect stats from this area. You will need to install another plugin called zonal statistics
Buffer and DTM values
- Create a buffer and of the site at 100 metres using the Fixed Distance buffer tool (under Vector menu or in the processing menu)
- Move the buffer layer into SpatiaLite (optional)
- Open the Zonal Statistics Plugin; Raster –> Zonal Statistics
- Use the DTM layer as the raster layer
- Buffered layer as the vector layer
- put dtm as the prefix
Take a look at the values now present in the buffered polygon layer. Is there much of an elevation change over the area (i.e. max-min or look at the mean).
Create a cleaner clipped layer from the number of cells raster layer
The raster layer calculating the number of cells that water passes through is a very useful layer for defining the edges of water sheds. As you may have notices in the digitizing video that layer illustrates issues with water movement. This layer can be used to also get a picture as to how much water will be re-routed once your building is in place.
Using Raster calculator, create a raster layer that only selects values greater than 90.00 from the number of cells raster layer.
- Raster –> Raster Calculator
- put in an query to get values above 90.00
- create a number_of_cells_gt_90 raster layer
Clipping out raster data
- Processing Tools –> Clip raster by mask layer –> use the image below as a guide
Run Zonal statistics again
- Use the buffer polygon layer as the vector layer
- Use the clipped cells_over_90 as the raster layer
- If you have a SpaitiaLite layer for the buffer layer, you can have a longer prefix, otherwise use something like cel90
Creating a creek layer from the clipped vector layer
Polygonize Raster layer
Using the Polygonize (Raster to vector) function in the processing toolbox convert the clipped cells_over_90 raster layer into a polygon vector layer.
- Processing toolbox with the setup similar to the image below
Select out the creeks and buffer them to create a new creeks layer
- Select out the values from your new polygon layer that contain creek locations and save this new layer as cells_creeks
- calculate the area of the polygons of the new layer as this Calculate Area VIDEO illustrates
- Buffer lines at 20 centimetres to create a new creeks layer
There are other tools from other software that QGIS can access such as SAGA, that will generate the centerlines of the stream networks (a package of tools exists in ArcGIS as well). For us, we will be happy with the results we have so far. These other methods work well, but take time for processing – so may be good for projects.
Digitize Paths to connect to the existing trails and Roads
Create a distance raster layer
Follow the following VIDEO to create a proximity layer for use in digitizing a road to the new buildings. This video also includes styling a layer and zooming to the right area for digitizing.
The methods used earlier in the lab will be applied again to add to a trail layer and road layer to add access to the building you have created. This can be done by:
- Create layers in your own workspace for roads and trails (for editing)
- These layers can be either shapefiles files or SpatiaLite
- ensure the edits you make create clean data – snapped to the other layers
The road layer used: /home/labs/geog300/unbc/campus_digitizing/unbc_campus_roads.shp
Follow this VIDEO to see how the proximity raster layer can be used to determine the best path from the lounge area to existing roads.
Ensure there is a method of connecting to the city layers
Load in the Zoning_Bylaw_7850_Class layer into a project with your buildings and the corrected roads. Using the road graph plugin to ensure you can reach a section of roads proximal to a polygon proximal to the nearest polygon with zoning RS2 and near a polygon with zoning Z19.
Styling to determine useful polygons
Use this VIDEO to load in the City layer and style buy only grabbing the zoning classes desired.
Clean your data and run a network analysis
You have edited the data add your road to the unbc_roads, but this does not mean the UNBC roads were actually clean in the first place. To double check, you can use the v.clean function in the toolbox to clean up the data. Another VIDEO (lots of movie watching…).
Amount of timber harvested from the building and parking area
As part of the assignment for this lab. Perform a simple subtraction of the surface (DSM) raster layer from the terrain layer (DTM), determine the area of the site and determine the average height difference in this harvested area. This is the area for the building and the parking (no the buffered area).
You have already performed all the tasks you need to do this section. Hints – look at raster calculator, calculating a field with the area and zonal statistics.
The all4_surface_filled and all4_terrain_filled raster layers are in the /home/labs/enpl303/forest_for_the_world folder