Calculating Street Intersection Density in QGIS

From CUOSGwiki
Jump to navigationJump to search

Introduction

Purpose

Street intersection density is a useful measure of network connectivity. This tutorial will show how to calculate street intersection density using QGIS. The analysis of calculating street intersection density is commonly used in transportation design, to scope out the best walkability of neighbourhoods and bike paths. This tutorial aims to demonstrate how to use spatial analysis in understanding spatial patterns for urban accessibility while also learning how to use an open-source GIS software available for anyone. In the end, creating a map showing intersection density across a city. This is useful especially for people in urban planning and land use planning.

For example, this tutorial will be calculating the street intersection density of the city of Ottawa.

About QGIS

QGIS (Quantum GIS) is a free and open-source GIS program released under the GNU General Public License. It has a wide variety of features that facilitate the display, analysis, and publishing of spatial data [1]. In the context of this tutorial, vector data editing and creating grids will be demonstrated. QGIS is available for download on a variety of operating systems from Windows, Mac, Linux, BSD and mobile devices.

Note

The QGIS version used here in this tutorial is 3.16 (the latest version as of December 2021) on a Windows operating system. When trying this tutorial, if you are using a previous or updated version of QGIS or on a different operating system, please keep in mind there may be differences in the figures and instructions shown in this tutorial.

Getting Started

Acquiring QGIS

To begin, download the latest version of QGIS on your operating system. QGIS is available for download on their website. HERE

Finding Data

Data for this tutorial was found through the City of Ottawa's Open Data Website [2]. HERE

However, to acquire spatial data for use in QGIS for other cities there are many open data resources including Open Data Catalogues, Open City, GeoHub etc. A simple Google search with the name of the city and the words “open data” next to it should give you at least a couple options.

Follow along into the next section to learn how to do this tutorial step by step.

Tutorial

Download Data

Figure 1. Downloading Wards file from Open Ottawa.

The two datasets we will need are:

1. The city boundary of Ottawa which can be found by searching Wards or click on this direct link HERE. Download in Shapefile format (see Figure 1).
2. The road centerlines within the City of Ottawa can be found searching Centrelines or click on this direct link HERE. Download in Shapefile format (same as downloading Wards file, see Figure 1 for reference).

Extract (unzip) both folders and save in the working directory you will be using.

Extracting Road Intersections

The first step is to extract the road intersections.

1. To begin, import both shapefiles into QGIS. Go to the Browser Panel (on the left of your new project screen) then navigate to where you stored the 2 shapefiles from your working directory. Drag and drop both shapefiles to the Layers panel.

With these files, because of the algorithm, there are some intersections considered for each line segment as a valid intersection. While most intersection points are correct, there are some false positives. For analyzing street intersection density, we need to extract only the intersections when 2 or more streets intersect. To do this, we need to merge all adjacent road segments.

2. Open the Processing > Toolbox (along the top row) and locate Vector geometry then double click on Dissolve (see Figure 2).
Figure 2. Finding Processing Toolbox and Dissolve tool.
3. In the Input layer, select Roads_Centrelines. In the Dissolved output layer, click on the three dots (shown in Figure 3) and then Save to File... enter Roads_Dissolved. Hit Run to process.
Figure 3. Inputs for Dissolve tool

Now, you will have a layer with all the road segments merged into a single feature. Next, we will be creating a layer that has all adjacent segments merged.

4. Similar to the previous step, go back into Vector geometry locate Multipart to singleparts and double-click. Select the layer Roads_Dissolved as the Input layer. Enter Roads_Singleparts as the Single parts output. Click Run (see Figure 4 for reference).
Figure 4. Inputs for Multipart to Singleparts tool.
5. Now, open the Processing Toolbox and locate Vector overlay double-click on Line intersections. Select Roads_Singleparts as both the Input and Intersect layer. Name the Intersections output layer as Roads_Line_Intersections. Hit Run(see Figure 5 for reference). This may take a couple minutes as it is a computationally intensive operation.
Figure 5. Inputs for Line intersections tool.

All the intersections are now correctly identified. However, there are a dew duplicate points from adjacent segments. It is time to remove these duplicates as we do not want an inflated number of intersections.

6. Still in the Processing Toolbox locate Vector general and double-click on Delete duplicate geometries. Select Roads_Line_Intersections as the Input layer and enter Roads_Intersections as the Cleaned output layer. Hit the Run button (see Figure 6 for reference).
Figure 6. Inputs for Delete duplicate geometries tool.
7. It is possible to remove the layers we do not need anymore, which are the layers Roads_Line_Intersections, Roads_Dissolved and Roads_Centrelines. Simply right-click on each and select Remove layer. So far, the map should look like Figure 7.
Figure 7. Map with layers Roads_Line_Intersections, Roads_Singleparts and Wards.

Creating a Grid

Conclusion

Resources

  1. QGIS: Defining what is QGIS https://www.qgis.org/en/site/about/index.html
  2. Open Ottawa: Data retrieval https://open.ottawa.ca/