Points to Path in QGIS

There may be times where you have a set of points (say from a GPS receiver) and need to create a path that connects them.  There is a useful tool in the processing toolbox in QGIS that enables the connection of those points, allowing you to determine the drawing order points and the resulting path or polygon.

This discussion starts with the assumption of some kind of geospatial point data in a CSV file.  At the very least, the points should have an X and Y value that QGIS can interpret, and it is a good idea to have a field in the data that specifies the drawing order, since the resulting paths can vary widely for the same set of coordinates, although any numerical field can be used to set the order.  Once your data is set up and imported into QGIS as a delimited text layer, pull up the “points to path” tool in the processing toolbox.  The input layer and drawing order field need to be set, but there is also a field that allows for the grouping of features, which outputs individual line features per group as well as a field to enter a storage location for the resulting vector file.

The examples below shows the output of this tool.  This is a set of five airports (Atlanta Hartfield-Jackson, Chicago O’Hare, Washington Dulles, Dallas-Fort Worth and Los Angeles International, in that order), connected by the resulting path based on a “drawing order” field in the data.  By editing that field, I can get a different path result from the same data points, as shown in the second example.  I chose this data in order to present this tool in a broad context, although it seems to be useful at much larger scales.

It is worth noting that these paths are treated the same as any other vector paths in QGIS, that is, they can be styled and edited just like any other, including adding nodes and changing start and end points.  They are not connected to the layer from which they were created, but are completely independent.  They do not follow any network other than the drawing order, so there is limited use for this technique for determining distances over a large area, but it could be useful when looking at points arrayed in a small region.  Another useful application of this tool might be in collecting handheld GPS data (from a simple device such as a phone) of corners of a piece of property and converting them into a polygon (with the aptly named “lines to polygons” tool, also in the processing toolbox).

Points connected to each other by path, based on the drawing order in the data table for the point layer.

Same set of points as before, but this time with a new drawing order in the data table. Any numerical field can be used to determine the order of connections.

Leave a Reply