Obtaining a sublayer of a layer for calculating shortest path algoritm in PyQGIS?

by Andres   Last Updated August 14, 2019 18:22 PM

I am trying to calculate the shortest path over a series of points via the road layer. For this, I am using the shortest path algorithm in the network analysis tool via the Python console.

However, the algorithm takes a while to be solved because the area of the layer roads that I'm using is quite large. I was wondering if there is a faster way to do this, maybe obtaining a sublayer of the road graph, and then running the algorithm over that sublayer.

To give an example, for the figure in below I'd like to calculate the shortest path between the green and orange point, over the area marked in red and not the entire road layer.

Is there a simple way to obtain the area marked in red, any suggestions on how can I implement it?

Related Questions

Python code to import OSM data

Updated February 17, 2016 02:09 AM

Grouping radio buttons under a checkbox in PyQGIS

Updated July 24, 2017 15:22 PM

PyQGIS - Automatically download local map

Updated August 16, 2018 09:22 AM