Hospital Site Suitability Selection using QGIS
Purpose
The purpose of this tutorial is to give users an understanding of what free and open source software (FOSS) is and demonstrate how to use Google Earth and Quantum GIS (QGIS) by manipulating spatial data. This tutorial will demonstrate how to use QGIS for site suitability analysis of a hospital in Vancouver, BC.
Introduction
When it comes to building a new hospital, there are criteria that should be followed in order to find the most appropriate location. Using a geographic information system to determine suitable areas for development allow the user to not only visualize where it is a suitable for a hospital to be located based on a set of rules, but also where it makes the most sense visually. Based on two papers (GIS-Based Multi-Criteria Analysis for Hospital Site Selection in Haidian District of Beijing (2012) and Hospital Site Selection Using Two-Stage Fuzzy Multi-Criteria Decision Making Process (2011)) the criteria for hospital site suitability can be summarized as follows:
Software
The two software packages required for this tutorial are QGIS and Google Earth. To download QGIS, click on this link and choose which version you would like. I would suggest downloading the Long Term Release Repository (most stable) as it is less likely to have any bugs then the latest version. To download Google Earth, click this link and select Agree and Download to agree to Google Maps/Google Earth Additional Terms of Service and download the software package. Once you have downloaded and installed both software, you are ready to download the required data for this tutorial.
Data
Create a working folder wherever you would like your files to be saved on your computer and within it place another folder titled Data. This is where you will store all of the needed you need to complete this tutorial. For this project, all of the data required is available at http://data.vancouver.ca/datacatalogue/, except for one KML file which you need to create in Google Earth. From the Vancouver data catalogue, you will need to download the shapefile packages for fire halls, local area boundary, railways, city streets, rapid transit, zoning districts and the KML file for public washrooms. To download a data file, scroll through the catalogue and click on the file name you want to download.
Then, scroll to the bottom of the newly loaded page and select the file type you want to download (for this tutorial we want shapefiles (SHP), if available or keyhole markup language files (KML) if not.
Save the file into the folder that you’ve created to store all of your data, and then unzip it by right clicking the zipped folder and selecting Extract All… and then choose to extract it into the folder storing all of the other data files you have downloaded.
Here is what the folder looks like once all of the data has been downloaded and extracted:
The file that is missing from the data catalogue but vital to this tutorial is a file containing the location of all of the existing hospitals in Vancouver. One way to create this KMZ file is to save all of the locations in Google Earth and export them as a KMZ. To do this you have to open Google Earth, search for hospitals in Vancouver, BC.
Next, click the folder icon below the search results that says “Copy the current search results to My Places” when you hover over it.
Now right click on the folder containing your search results and select Save Place As...
Tutorial
Now that you have downloaded the software and shapefiles, it is time to begin.
Setting Up the Environment
Go to the Project menu, select Projection Properties. The Projection Properties windows will open. Select CRS from the left hand menu and then toggle on Enable on the fly CRS transformation. The CRS that should be selected is NAD83(CSRS) / MTM zone 9 if in the Ottawa region. Click Apply and OK.
Adding Shapefiles into QGIS
Once QGIS is launched, go to the Layer menu -> Add Layer -> Add Vector Layer. In the pop-up window, set your source type as File and click the Browse button under the Source header. Browse to where your shapefile is and double-click it or highlight it and select Open. Insert each of the shapefiles you would like to analyze. Modify each shapefile to look the way you would like it to by double-cliking the layer from the Layers Panel on the left hand side, then selecting Style from the left hand side of the popup window. Here you can change the symbol type (such as gradient, single symbol, categorized etc), the colour, the size and more.
Editing Attribute Tables: Selecting by Expression
Right click on the accidents layer and select Open Attribute Table. An attribute table of the accident layer will appear and it will have the different types of impact and the two street names where the accident occurred. Once you have the attribute table open, select Select Features Using an Expression. A Select By Expression window will appear, and in the function list, expand the Fields and Values and select Impact Type. Select the all unique button in the bottom right corner beside Load values and a list should appear of the unique values from this attribute. The field values will have the list of different impact types that were seen in the attribute table.
In the expression box of the select by expression window. When you double click on the Impact Type, "ImpactType" will appear. Once that appears, you select the equal (=) sign where the available operators are listed. The next step is to select a field value. In this example, the first field value selected is Angle. The expression should be "ImpactType" = 'Angle'. Once this expression has been selected, the impact types that are angle are now highlighted on your map.
Saving Selected Points (Shapefile)
The selected points that are now highlight can be saved as their own shapefile. To do this, right click on the accidents layer and select Save As and a window will appear. In this window, the format that the shapefile should be saved under is "ESRI Shapefile". Click the Browse button to choose where the file will go and give it a name. Toggle on Save only selected features and Add saved file to map and then click OK.
Repeat both the Editing Attribute Tables: Selecting by Expression and Saving Selected Points (Shapefile) steps until all the impact types have been saved as their own individual shapefiles.
Selecting a Specific Area
To select a specific area, open the attribute table for the wards-2010-2 shapefile layer. Click on the Select features using an expression button.
The Select By Expression window will appear, and in the function list, expand the Fields and Values and select the specific area you want to study. In this case, it is Barrhaven. Because the wards in this file is listed by number and not name, we must consult a reference list.
The expression should be "WARD_NUM" = '3' because we want to select Barrhaven. If we were wanting to select more than one ward at a time, our expression would be for example "WARD_NUM" = '3' OR "WARD_NUM" = '22' which would select both Barrhaven and Gloucester-South Nepean. To save the selected shapefile, right click on the wards-2010-2 layer and select Save Selection As and a window will appear. In this window, the format that the shapefile should be saved under is "ESRI Shapefile", give the shapefile a name and toggle on Add saved file to map.
Clipping Files
When the newly merged shapefile has been made, you can simply clip all of the other information (accidents, roads, railways, pedestrian paths) onto the study area as well. To do this, go to the Vector Menu, select Geoprocessing Tools and then select Clip. A clip window will appear and the input vector layer will be what shapefile you want to clip onto the output vector layer. For example, to clip the roads, the input vector layer should be Road Segments and the clip layer should be the Barrhaven shapefile we made from our previous selection. For output shapefile, you can browse to the folder that contains all of your other shapefiles and choose a name for your clipped file.
When clipping the other shapefiles, the clip layer remains the same, but the input vector layer changes. Format the style of your clipped shapefiles to your liking.
Analyzing the Data
To see how many of each accident type occur, we can look at the attribute table. For example, in our recorded data for Single Vehicle Unattended Accidents in the Barrhaven ward, 10 incidents occurred.
To see how many accidents occur within 100 m of a railway track, we can first create a buffer around our clipped railways shapefile. Select Vector -> Geoprocessing Tools -> Buffer. In this example, a buffer distance of 100m was used and the segments to approximate value was 25 (this mean that our finished polygon will have 100 sides (the higher the segments to approximate value, the smoother the buffer). We save this in our desired folder with a file name of our choice.
Because we want to know how many accidents of any type occurred within 100 m of a railway, we can clip our original accidents shapefile to our Barrhaven polygon.
Here’s the outcome:
To find out how many accidents occurred within our buffered region, we can make a clip of accidents in Barrhaven from our railway buffer.
From the output layer and it’s attribute table we can see that only one accident occurred within 100 m of a railway in Barrhaven.
Using these methods, you can perform a multitude of operations to interpret things such as how many accidents occur within a distance from pedestrian pathways, how many accidents occur within a ward, how many accidents occur within a distance from railways, how many of a certain accident type occur within a distance from other accident types etc.
Making a Map
Once we have produced the data that we want to showcase, we can use QGIS to make an aesthetically pleasing map. First, turn on all of the layers that you would like to be showcased and turn off all others by selecting and unselecting the checkbox next to each layer name. I want to showcase different types of accidents that occur within Barrhaven so I have selected these layers:
Select Project -> New Printer Composer and then type a name for your map in the text box and select OK (it does not have to be the same as the title you place on your final map). In the pop-up window, select Layout -> Add Map and then draw a rectangle on your canvas where you would like your map. To reposition your map display, select Layout -> Move Content. Now you can drag your map into place and zoom in and out. Under the Item Properties tab on the right hand side, you can also change the scale to get the perfect sizing.
To add a title, select Layout-> Add Label and draw a box for your title. Under Item Properties -> Label you can type your title in the textbox and change the font type, size, colour etc.
To add a north arrow, select Layout -> Add Image and draw a box on your canvas. Under Item Properties -> Search directories you can view different North Arrows and choose which one you would like to use.
Similarly, you can add a scale bar by selecting Layout -> Add Scalebar.
To add a legend select Layout -> Add Legend. To show only the legend items that are present on your current map, select the icon that resembles a filter cone under the Item Properties -> Legend items menu. To rename legend items, double click a legend item and enter the text you want displayed. You can also rearrange legend items by dragging them up and down. Once you are happy with your map, you can export it as an image, SVG or PDF by selecting Composer from the top left hand menu and choosing either Export as Image, Export as SVG or Export as PDF.
Conclusion
QGIS is an intuitive and user-friendly software that in this instance has allowed the production of a map that showcases traffic accidents in the Barrhaven ward of Ottawa as well as allowed the user to analyze different scenarios. This is just an example of the many ways that a few shapefiles can be combined to produce a multitude of useful and easily understood data
References
- City of Ottawa. (2017). OpenData Ottawa | City of Ottawa. Retrieved October 9, 2017, From City of Ottawa: http://data.ottawa.ca/
- City of Ottawa. (2014). Safer Roads Ottawa Program | City of Ottawa. Retrieved December 20, 2014, from City of Ottawa: http://ottawa.ca/en/residents/transportation-and-parking/safer-roads-ottawa-program
- City of Ottawa. (2014). Safety Improvement Program | City of Ottawa. Retrieved December 20, 2014, from City of Ottawa: http://ottawa.ca/en/residents/transportation-and-parking/road-safety/safety-improvement-program
- MacOdrum Library. (2014). Maps, Data and Government Information Centre | MacOdrum Library. Retrieved December 19, 2014, from MacOdrum Library: https://www.library.carleton.ca/contact/service-points/maps-data-and-government-information-centre
- QGIS. (2014). Discover QGIS. Retrieved December 20, 2014, from QGIS: http://www.qgis.org/en/site/about/index.html
- QGIS. (2014). Download QGIS. Retrieved December 20, 2014, from QGIS: http://www.qgis.org/en/site/forusers/download.html
- Wikipedia. (2017). Wards of the City of Ottawa. Retrieved October 13, 2017, from https://en.wikipedia.org/wiki/Wards_of_the_City_of_Ottawa