Dec 14, 2022 • Blog

How to Draw a Travel Time Polygon with QGIS

facebook iconx icon

Contents

In this blog post, you’ll learn:

  1. How to create a travel time polygon
  2. How to calculate the area of a single polygon
  3. How to merge / overlap several travel time polygons into one

The Traveltime QGIS plugin lets you draw travel time polygons on a 2D map and show the maximum distance you can travel within a predefined time frame. Creating this catchment area is useful if you want to identify the total reachable area. You can even cross reference this with population data to see how many people live in this area.

What is a polygon?

A polygon is a 2D shape consisting of a series of x and y coordinates that enclose an area. They are used for many purposes, such as creating heat maps, which is a data visualization technique that shows the magnitude of a phenomenon as color in two dimensions. Polygon features are used in a GIS to display areas of different geometrical shapes and sizes. This could be an island, a city or a parcel. Other major geometrical shapes used in GIS are points and lines.

Downloading and configuring the TravelTime plugin for QGIS

We’ll be using QGIS for drawing our travel time polygon, so we start with opening QGIS and create a new, empty project that we save locally. QGIS is a freely available, open source desktop GIS application that can be downloaded here for different platforms. Before we can use the TravelTime plugin for QGIS, we have to make sure it’s installed and configured correctly to have our travel time polygons drawn. You can download the plugin from inside QGIS by heading over to the Plugins tab in the main application screen and click “Manage and Install Plugins”. Search for the “TravelTime platform plugin” and click Install. The plugin should now be visible in the main map window:

main map window
Figure 1: The TravelTime plugin menu in QGIS

To configure the plugin, you first need to sign up for a TravelTime account to receive an API key here or click the far-right button on the TravelTime platform menu inside QGIS that says “configure TravelTime platform plugin” and click the “get a free API key” button. After confirming your email address, you can login to the online TravelTime dashboard where you’ll find your unique app ID and API key. These need to be set inside QGIS next in the configuration menu described above. Set the App ID number and API key and click “OK” and you should be ready to use the TravelTime API to draw travel time polygons inside QGIS.

Adding map data to the empty map window

Before we can add a travel time polygon to the map, we first need to add some map data. We add the OpenStreetMap base map to our map window, which is found in the Browser window under XYZ Tiles. If it is not available there, please consult this resource to add a connection and add it to the map window.

Figure 2: The OpenStreetMap basemap

Another easy way to add basemaps is by installing the QuickMapServices plugin. Search for this plugin under the Plugins menu, install it, activate it by marking the check box under “installed” to activate the plugin and head over to the Web menu in the main menu, select QuickMapServices and click “settings”. Next, click the “Get Contributed pack” button and reopen the plugin under the Web menu to see more basemap options:

Figure 3: More basemap options are available through the QuickMapServices plugin

We are now set to start drawing travel time polygons on the map.

Creating a travel time polygon or catchment area with the TravelTime QGIS plugin

The TravelTime plugin for QGIS draws travel time polygons (also called catchment areas) on the map based on a preconfigured transport modality and maximum travel time in minutes. 

As an example, we first zoom into a recognizable part of London, showing us the City of Westminster, City of London and the Isle of Dogs, among others. Next, we can click the Quick Time Map button in the plugin menu. This lets us click anywhere on the map, after which a travel time polygon is drawn instantly. We set the following presets: we want a polygon when using public transport with a maximum travel time of 30 minutes. Press escape, so the mouse cursor turns into a cross, and click anywhere in the map window. A travel time polygon is drawn and is added to the layers pane as Output. With some additional layer styling, we get the following results:

Figure 4: A Quick Time map of Central London, showing a travel time polygon with a maximum travel time of 30 minutes when using public transport

Calculating the total area of a travel time polygon in QGIS

The area of this travel time polygon is found using the Identify Features Tool, which is found on the top right of the main menu, or by pressing CTRL+SHIFT+I:

Figure 5: The Identify Features Tool in QGIS

After selecting the Identify Feature Tool, click anywhere on the travel time polygon feature and open the “derived” dropdown menu. You’ll see the total area in square meters under “area”, which translates to 29,7 square kilometers.

Figure 6: The total area of the travel time polygon in square meters

Adding multiple travel time polygons, merging them into a single polygon and calculating the total area

We will now repeat the process of creating travel time polygons so that we will end up with three overlapping travel time polygons. We will then merge these polygons and calculate their total area in QGIS. There are multiple ways to create travel time polygons using the TravelTime plugin. For example, in addition to using the Quick Time Map tool multiple times and simply on three close areas, we can also geocode a series of addresses in the same area and add them as points on the map. 

That way, we can create a Time Map using a point layer containing the addresses and have the individual polygons returned in a single layer. Reversely, we can create three random points that are geographically close to each other, store these in a layer file and reverse geocode these, and run the same Time Map tool as described above. All three options are supported by the TravelTime QGIS plugin, which also offers geocoding and reverse geocoding tools.

Creating and geocoding random London addresses

Here, we will geocode two randomly selected addresses and add them to the map as point features. Using this online random address generator, we can generate random addresses in London and create a csv file by opening an empty notepad file and create a header with the following address details:

street, address, city

897 Station Road, E14 6GL, London

33 The Green, London, EC75 3JC

Save the file as london_addresses.csv. Next, click the “Show the toolbox” button on the TravelTime menu (far left). Next, click Geocoding and use the following tool parameters and click “Run”:

Figure 7: Geocoding tool parameters from the TravelTime plugin for QGIS

As a result of running the tool, two point features are added to the map in a single layer. This layer will serve as input for the Time Map tool, to create two travel time polygon features at once.

Creating multiple travel time polygons and merging them into a single polygon

Run the Time Map tool, which is available from the TravelTime toolbox under the Advanced menu. This tool enables running input layers with multiple point features, creating multiple travel time polygons that can be merged into a single polygon if necessary. Set the layer with both address points as input layer and set the Departure / Travel Time to 1800 seconds (which equals 30 minutes) so we’re sure both individual output polygons overlap, which is necessary to merge them into a single polygon:

Calculating the total area of merged polygons

Do not hit “Run” yet, but scroll down and set Result Aggregation under Output options as “UNION” to merge both travel time polygons. Click “Run”. The result is the following merged polygon, with an area of 73,5 square kilometers:

This polygon can be used for further analysis. For example, by merging the two polygons into one, it is easier to extract features inside the polygon as you can now clip the polygon and use its boundary to extract features inside of the area. You can also perform a population analysis using this shape - follow our tutorial here.

In this article, we’ve covered how to create a travel time polygon in QGIS using the TravelTime QGIS plugin. We’ve shown how to draw a polygon using the Quick Time Map feature, where a polygon is drawn using a preconfigured transport modality and maximum travel time after clicking anywhere on a map. Next, we described how to calculate the total area of the polygon that is drawn on the map in QGIS. Next, we’ve created three different points on the map by geocoding a set of addresses in London. After drawing a set of travel time polygons for each address point in QGIS, we merged the overlapping polygons to a single polygon and calculated the total area (or sum) for that merged polygon.

facebook iconx icon

Contents

Calculate thousands of travel times with the TravelTime API

Discover more
cta accent icon