Jan 11, 2023 • Blog

QGIS Points in Polygon Tutorial

facebook iconx icon

Contents

QGIS is a free open-source software that enables developers to create and edit geographical and geospatial information. Using TravelTime’s plugin, this tutorial demonstrates how to use point in polygon calculations within QGIS.

In-depth documentation of the Traveltime plugin for QGIS can be found here.

For this particular tutorial, we aim to identify which of our own employees would be able to travel from our London head office to their homes, within 90 minutes of a 9am departure time. We’ll do this by identifying destination points within a given polygon - in this case, a public transport polygon.

Tools which will be used in this tutorial:

Creating the Public Transport polygons using 'Time Map' tool

 1. Point in polygon is essentially about filtering points within a polygon area.  The points are demonstrated in this visual.

points

2. To create the Public Transport polygons, we select the TravelTime plugin ‘time map’ tool as shown, selecting ‘public transport’ as the transport type, applying a 90 minute journey time and leaving at 9am.

plugin

In the ‘Enter Address’ bar, we’ve applied our office address postcode as the starting point: WC2H 7JA.  Upon entering the postcode, the ‘run’ icon is enabled.

3. Once calculated, the user is presented with a polygon that represents the area reachable within a 90 minute journey time, using public transport, from the starting point stipulated.

4. Once set, amendments to the Output Properties (colours and styles) of the layer help to make the polygon more visible.

Output Properties

This provides a great example of how travel time, as opposed to distance, should be considered when developing location / journey calculation tools.  Using public transport, Milton Keynes is just as accessible from the stated start point, within a 90 minute timeframe, as destination points that are geographically much closer.

5. To do the point in polygon calculation, we use the clip tool, which we search for in the Processing Tool Box.

Processing Tool Box

The Input layer is our employees (this defines the points we are going to filter using the polygon).

Employees

6. The Overlay Layer is the polygon based on the output we’ve previously generated. Hitting ‘run’ then adds a new ‘clipped’ layer to the project, showing all the points that fall within the Public Transport polygon.

This is a fairly straightforward process; first of all creating a catchment area, then using that area to filter the points / locations within it.

However, there is a faster way of achieving the same output, using another TravelTime tool.

Creating the Public Transport polygons using 'Quick Time Filter' tool

1. Again, we start by taking our employees as the Input Layer. But rather than creating and polygon and then using it to filter the points, we can apply TravelTime’s ‘Quick Time Filter’ tool.

Input Layer

2. We can then apply the exact same parameters as before, selecting Public Transport as the transport type, setting the 90 minute journey time, the departure point (our Head Office office postcode) and leaving time (9am).  The results here show a different output.  Rather than displaying a polygon, we can see a new layer of points, visually showing which ones are reachable or unreachable within the set parameters (green pins indicate the ‘reachable’ points).

Layer of points

We can compare the results of these two different methods.  The points calculated within the polygon are an exact match of the reachable points pinned using the ‘Quick Time’ filter.

A further benefit of using the Quick Time filter, is a feature that enables the user to view the exact journey time for each employee(point) within our selection.

3. Opening up the Attribute Table of the new layer, the user is presented with a table of all employee points, an indication of whether that point is reachable or unreachable within the stipulated parameters (shown as a 1 or 0 in the ‘reachable’ column) and also a journey time in seconds.

This tool not only provides a visual demonstration of reachable points within the polygon, but also returns additional data for each point. Instead of a simple ‘in/out’ point in polygon analysis, we have individual travel times for all of the reachable points as well.

polygon analysis
facebook iconx icon

Contents

Calculate thousands of travel times with the TravelTime API

Discover more
cta accent icon