Service Area Analysis using Openrouteservice (QGIS3)

Service area analysis is useful in evaluating accessibility of locations. Given locations of fire stations, hospitals, public transit stations etc. you can use such analysis to identify what areas can be served from these locations by either amount of distance traveled or by time taken. Till recently, such analysis was difficult using open-source tools and data. But now we have access to a global street network using OpenStreetMap (OSM) and free web-services such as Openrouteservice (ORS) that can perform complex routing tasks using OpenStreetMap (OSM) data. In this tutorial, we will use the ORS Tools Plugin to perform service area analysis in QGIS.

Privire de ansamblu asupra activității

We will use metro rail station data for Kochi, India to determine areas that are within 15-minutes of walking distance.

Alte competențe pe care le veți dobândi

  • How to load General Transit Feed Specification (GTFS) transit feed data in QGIS.

  • How to convert sequential point data to line tracks using the Points to Path tool.

Obținerea datelor

Kochi Metro Rail Limited (KMRL) provides open data for the Kochi Metro Rail Project in Global Transit Feed Specification (GTFS-static) format. Request for data download by visiting the Open Data page.

Pentru comoditate, puteți descărca o copie a seturilor de date direct de la adresele de mai jos:

KMRL-Open-Data.zip

Sursa de date [KMRL]

Instalare

Openrouteservice API provides routing algorithms that work on free geographic data from OpenStreetMap. It is a free web-based service that can be accessed via a QGIS plugin. While the service is free, it requires you to sign-up and get an API key. The API key is used to prevent abuse and enforce limits on usage.

  1. Visit Openrouteservice Sign Up page and create an account. Once your account is activated, visit your Dashboard and request a token. Select Free as the Token type and enter ORS Tools QGIS as the Token name. Click CREATE TOKEN.

../../_images/setup12.png
  1. Once created, copy the long string displayed under Key. This is a unique identifier linked with your account that will be used to authorize use of this service.

../../_images/setup21.png
  1. Open QGIS. Visit Plugins ‣ Manage and Install plugins. Search for ORS Tools plugin and install it. Click Close.

../../_images/setup3.png
  1. In the main QGIS Window, go to Web ‣ ORS Tools ‣ Provider Settings.

../../_images/setup4.png
  1. Expand the openrouteservice section and paste the key (copied in step 2) in the API Key text-box. Click OK.

../../_images/setup5.png

Procedure

  1. Unzip the downloaded KMRL-Open-Data.zip file to a folder on your computer. You will notice that the unzipped directory contains many text files. Each file contains data for a different aspect of the transit system. The format of the files and their uses are described in GTFS Reference. Out of all the files, 2 files contain geospatial data and are of interest to us. The file shapes.txt contains points that describe a physical path that the vehicle takes, and the file stops.txt contains the location of each transit stop. Both of these are CSV files that can be imported into QGIS. Click the Open Data Source Manager button.

../../_images/1143.png
  1. In the Data Source Manager dialog, switch to the Delimited Text tab. Click the button next to File name and browse to the shapes.txt file. Select CSV (comma separated values) as the File Format. The X field and Y field should be auto populated. Click Add.

../../_images/2122.png
  1. Similarly, click the button again and select stops.txt file. Click Add. Click Close.

../../_images/364.png
  1. You will see 2 new layers stops and shapes added to the Layers panel. Let’s convert the shapes point layer into a line layer representing the path of the metro line. Go to Processing ‣ Toolbox.

../../_images/433.png
  1. Search and locate the Vector creation ‣ Points to path tool. Double-click to launch it.

../../_images/529.png
  1. In the Points to Path dialog, select shapes as the Input point layer. As per GTFS specifications, each individual route has a unique shape_id so select that from the drop-down menu as the Path group expression. We can also specify the order of points that will form the line by selecting shape_pt_sequence as the Order expression. Click Run.

../../_images/628.png
  1. A new layer Paths will be added to the Layers panel. You can turn off the visibility of the shapes layer to see the newly added line layer.

../../_images/728.png
  1. Now that we have the metro stations and line data added, we are ready to start the network analysis. In the Processing Toolbox, search for and locate the ORS Tools ‣ Isochrones ‣ Isochrones From Layer tool. Double-click to launch it.

../../_images/827.png
  1. Select openrouteservice as the Provider. We will be computing a 15-min walking distance polygon from each metro station. Select stops as Input Point Layer. Select stop_id as the Input Layer ID Field. From the Travel mode drop-down, select foot-walking. As we are interested in time-based area, select time as the Dimension. Finally enter 15 minutes as the ranges. Click Run.

../../_images/928.png

Notă

Note that the Openrouteservice API has a limit of 20 requests per minute for Isochrones. So if your layer has more than 20 points, you may see errors indicating that the rate limit exceeded. You can keep the tool running and it will continue processing 20 points / min.

  1. Once the tool finishes, you will see a new layer Isochrones loaded in the Layers panel. Each point has an associated polygon representing the area that is accessible within 15 minutes by walk. To see this in the context the data that was used to generate them, we can add the OpenStreetMap basemap. Scroll down the Browser panel and locate XYZ Tiles ‣ OpenStreetMap. Drag it to the canvas.

../../_images/1034.png
  1. A new layer OpenStreetMap will be added to the Layers panel. Drag it down to change the layer order and keep it at the bottom of the layer stack. Zoom and pan to see if the results match the road network. You will see that the polygons are not circular, because the travel time is computed along roads, so the regions that have no roads will have lesser area covered.

../../_images/1144.png
  1. To compute the service area, we need to complete one last task. We can merge individual isochrone polygons to form a single polygon representing the areas that are accessible. Search for and locate Vector geometry ‣ Dissolve.

../../_images/1237.png
  1. Select Isochrones as the Input layer and click Run.

../../_images/1335.png
  1. Once the processing finishes, a new layer Dissolved will be added to the Layers panel. This polygons represents the full region that is accessible from the metro system within 15-minutes of walk.

../../_images/1432.png

Notă

This is a simple example of how a service area analysis for a public transportation project can be done in QGIS. A more comprehensive service-area analysis for the metro system would include other modes of transport. We could include feeder buses, nearby bus stops and routes serving those bus stops to expand the analysis. We may also include travel by other modes such as car and taxi.


If you want to give feedback or share your experience with this tutorial, please comment below. (requires GitHub account)