Did you know that there is a network analysis library in QGIS core? It’s well hidden so far, but at least it’s documented in the PyQGIS Cookbook. The code samples from the cookbook can be used in the QGIS Python console and you can play around to get a grip of what the different steps are doing.
As a first exercise, I’ve decided to write a Processing script which will use the network analysis library to create a network-based route layer from a point layer input. You can find the result on Github.
You can get a Spatialite file with testdata from Github as well. It contains a network and a routepoints1 layer:
The interface of the points_to_route tool is very simple. All it needs as an input is information about which layer should be used as a network and which layer contains the route points:
The input points are considered to be ordered. The tool always routes between consecutive points.
The result is a line layer with one line feature for each point pair:
The network analysis library is a really great new feature and I hope we will see a lot of tools built on top of it.