On 21 March 2018 at 07:29, <[email protected]> wrote: > So, I'm trying to do bunch of shortest distance calculations using two point > layers and a line layer. Reading the forums etc. I gather there isn't a GUI > solution for this. As a result, I'm trying to adapt the code here: > > https://gis.stackexchange.com/questions/171896/how-to-calculate-shortest-path-from-points-in-one-layer-to-points-in-another-lay > > I'm using Qgis version 3.0.2.
That code won't work in version 3 - it's using the old 2.x API. In QGIS 3.0 there's two built-in processing algorithms "Shortest path (layer to point)" and "Shortest path (point to layer)" which sound like they almost do what you need (I gather you need "Shortest path (layer to layer)"?). If so, I'd start with either of these and adapt it to do full layer-to-layer joins: https://github.com/qgis/QGIS/blob/master/python/plugins/processing/algs/qgis/ShortestPathLayerToPoint.py https://github.com/qgis/QGIS/blob/master/python/plugins/processing/algs/qgis/ShortestPathPointToLayer.py If you get close (or even if you get stuck), open a PR against the QGIS github repo with your work and we'll guide you through. This would be a handy algorithm to have available out-of-the-box. Nyall _______________________________________________ Qgis-user mailing list [email protected] List info: https://lists.osgeo.org/mailman/listinfo/qgis-user Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
