In the previous labs we have looked at how separate layers can be investigated and represented by queries and presentation of differing attributes. We have seen how different layers can be related to each other visually and today we will practice some GIS overlays to model different layers together. As usual you should create a directory for your work. This should be in your geog204 directory and call it lab4. The data sets for this lab are in n:gislabsgeog204tutlab4. Here you will see a multitude of available layers.
Working in Google Earth
By now it should be second nature to open QGIS and load data into a project. Today however we are going to start in Google Earth. In the last tutorial we selected out the Census Tracts for the city centre of PG, saved them as a KML file and brought it into Google Earth. Today we are going the opposite way.
Open up Google Earth and zoom to the University and the surrounding area. Turn on the “Places” layer in the bottom frame of Google Earths table of contents (should be on by default). Zoom to a level whereby you can see the churches along Westwood drive. If you remember you can create your own directory tree in Google Earth. We are going to create folder to hold point data and then bring the data into QGIS by doing the following:
- Create a folder under temporary places called churches.
- Now right click on each church individually and select copy
- Go to the churches folder, right click select paste
- Once all three have been selected
- Save place as
- Save as a KML file called churches.kml in your newly created lab 4 directory
Checking distance within Google Earth
See if you can figure out how to calculate the distance in Kilometres from the centre point outside the cafeteria to the closest and farthest churches on Ospika (as the crow flies).
Question 1: Determine the approximate distance to the church on Ospika by road. Write down the steps you did to perform this query.
Viewing your KML data in QGIS
See if you can figure out how to bring in this KML file into QGIS. Once you have done so load the roads layer in the /home/labs/geog204/tutlab4/google_earth_layers directory. You can see that your points should line up in the right place
Interesting piece of information
With your kml layer in the project, check out the attribute table. Expand the description field as far as you can. Notice that this is a very long entry!! We will come back to this later on with a shape file version of the same file. Remove all the layers in your project before we go to the next step (or start a new project without saving).
Set Project properties for the next set of layers
After removing all the layers in your project for the churches, we will make sure there is no issues with layer projections (we will be going over projections in tutorial next week) by:
- Project –> Project properties –> CRS –> turn off “Enable on the fly CRS transformatoins”
- Settings –> Options –> CRS Tab –> don’t enable on the fly projections
Spatial relationships between layers in QGIS
Go to the tutlab4 directory for the geog204 labs and open the shapefiles that are in that directory (but not the directories under it).
Looking closer at the data
Set up your view in a way that it is easy to see as much information as possible around Prince George (HINT: Can you select a layer that fits the extent of PG…?) Have a quick look at the differences between where the dabc,eabc and the pgbound layers line up on the perimeter of the City limits.
- Do all three line up – do any line up? (does this discrepancy remind you of other occasions where data did not “fit” each other). We will be going over this more in the lab next week as well.
- Does it look like we can compare the spatial information (boundaries) from Enumeration Areas with the Dissemination Areas (Does it work in some areas)?
- We cannot determine which layer may be in the proper location without any meta data (i.e. *.meta files), but you can see that the pgbound and the roads data seem to line well together.
- What do the units of measurement do these layers seem to be in? (Map units). Remember this for later on!!
You should have some ugly scene like this:
Image zoomed into PG
Line Buffer and Select by Location:
We want to find out the street that the hospital is on. We are going to do this by creating a line layer to use below: (IMPORTANT – When you create your line layer, put in 26910 into the search line and select it as the CRS to use).
- Draw a line on a new line layer (perhaps linetrace.shp) that follows the road the hospital is on for a fair distance
- Buffer that line at 100 metres to create a new linetracebuf.shp layer
- Use the select by location to see which points in the roadname layer intersect (in this case are within) this new buffered layer
- Check the results of the selection in the attribute table of the roadname layer and see which value is repeated
- We drew lines and used select by location to fund this value – Is there more than one way to find intersecting features between layers
Question 2: Write down the steps you did to get the name of the street the hospital is on. How could you get the same results without having to digitize a line along the road?
Question 3 Does the road layers appear to be clean and built. Do the line sections overlap like spaghetti data? What does the attribute table tell you about clean/built data and whether it follows the old topological model? Were polygon layers built from this line layer?
Spatial Overlay Examples:
Here are some graphical examples from ESRI documentation of what we are going to do in the following sections.
|Clip||Erase of Difference|
GeoPorcessing – using Spatial Overlays:
As we have found out through our use of QGIS, that there are many ways to accomplish GIS tasks in the software. As QGIS leverages other Open Source Software, we can expect to find duplicate tools that perform the same (or very similar) task. Most of the tools we find in the menu (such as GeoProcesing Tools under the Vector menu) can be found in the toolbox launched from the Porcessing menu. We encourage you to try as many of the different tools as you can.
First we are going to reduce our study area to include only the areas within the city limits of Prince George. By using google (and the above illustrations) look up what a “CLIP” overlay does. Remember you need to have a polygon layer to clip with. The pgbound layer is a line layer however! What did we do before to make a line layer a polygon layer (we built a line layer into a polygon layer)? Try to see if you remember how to do it.
You will see (as we experienced before) that there is a difference between a polygon layer built with the linetopolygon function under the vector tool box and the polygonizer (do we remember why that is?). Scott has created a pgboundpoly layer in the builtpolygons directory in tutlab4 (in case you have difficulty building a polygon shape file from pgbound. Load the pgboundpoly layer into your project and clip out the dabc and hospital layers to dapg and hospitalpg layers.
Which Clip function did you use in your analysis for instance the same version of clip can be accessed by either:
- searching clip in the toolbox, then selecting the QGIS Clip
- going to the vector menu –> GeoProcessing –> Clip
Buffering and intersecting
Buffer the hospitalpg layer at 1.5 Kilometres. If you choose the QGIS Buffer tool (fixed distance buffer), the interface requires a value for a number for segments? What do you think that is for – you can create a few versions with different values to determine what that requirement represents (HINT: we are working with simple features).
Now perform both a Clip and and Intersect (Intersection in the QGIS tools) it with the dapg layer – we will call these buffered areas medical service zones (ie: pgmed_clip.shp and pgmed_intersect.shp), Once these overlays are completed, check out the attribute tales of the two layers.
Question 4: Write down the steps you just did to get the dapgmed layer. Why are the attribute different?
Creating a dough nut
If we wanted to add a buffer of the hospital to this at 0.75 Kilometres (to remove data from the medical services zone within that distance of the hospital – create a dough nut from the medical zone), what geoprocessing tool would we use? Lets perform the tasks necessary to create a medical zone with a no go “hot zone” in the middle . (Hint look at the examples images above).
Question 5: What is the approximate ratio of area covered by the medical services zone (without the dough nut) compared to the original area of the DA unit numbered 59530065? You can approximate by eyeballing the two polygons, but you can also get more information from the attribute tables and information button (BUT be careful what attributes you look at). Write out the steps you used to create the dough nut that created the altered medical zone with hot spot.