[Qgis-user] Shortest path caching

Paul Wittle paul.wittle at dorsetcouncil.gov.uk
Mon Sep 16 23:58:43 PDT 2019


Hello Both,

Thank you for your answers so far and I could indeed get on with the python methods but I’m trying to build a solution which a normal user would understand with minimal effort really.

I’m currently looking at using the graphical modeler to create a routing which will replicate (albeit inefficiently) the Travelling Sales routing by running shortest route in batch form. I think I got 90% of the way yesterday before I ran into the obvious issue with the process modelling.

Is there any way to output a string from a process which you can then use as an input in another process?

I ask because all the routing algorithms require at least one ‘point’ (string) input. I have extracted the coordinates from my points layer as a string in the form ‘x, y’ and I can see the string if I run that section separately but I can’t set the string as an input for shortest route algorithm in the modeler.

I’m thinking that the best method would probably be to run a distance matrix and then use that to construct a series of A – B routes in order, run each of those and then stick them together to create the output. Given the comment that “Both points (start A and end B) are “tied” to the graph when it is built”; I’m pretty convinced that my plan of using clipped versions of the network for the routing may still be the best method for QGIS.

I’m aware that this is really using a spade to dig up a road when really I should be just investing in a digger but the goal here is to see what can be achieved with QGIS 3.4 as it stands today. I’m not too fused if it takes 5 minutes to run a 30 second job so much as whether it can be achieved accurately and using a method that end users might be able to understand.

Thanks,
Paul

From: Nicolas Cadieux <nicolas.cadieux at archeotec.ca>
Sent: 16 September 2019 16:09
To: DelazJ <delazj at gmail.com>
Cc: Paul Wittle <P.Wittle at dorsetcc.gov.uk>; qgis-user at lists.osgeo.org
Subject: Re: [Qgis-user] Shortest path caching

Hi Harrissou

I was referring to the online documentation in the developers cookbook.  The user guide is effective.  I perfectly understand the problem and wish I could help but despite receiving help from advance users with links to online code examples (thanks), I found it easier to go with NetworkX that was well documented.  Maybe I could figure it out now since I now have experience working with shortest path analysis and now grasp the basic concepts of networks but when I started the project, it was a big learning curve.

Cheers

Nicolas

Le 16 sept. 2019 à 09:36, DelazJ <delazj at gmail.com<mailto:delazj at gmail.com>> a écrit :
Hi,

Le lun. 16 sept. 2019 à 15:25, Nicolas Cadieux <nicolas.cadieux at archeotec.ca<mailto:nicolas.cadieux at archeotec.ca>> a écrit :
Hi,

You could go with NetworkX, a python library.  With that, you can build the graph on the fly and maintain it as roads or edges get added and removed.

You can probably do this with QGIS but the biggest problem I found with QGIS is the lack of documentation for using the network analysis tools using the latest versions. Everything is, or was documented for version 2.x.  Also, when using the processing tools in a batch, the graph gets rebuilt every time this should not happen.

Nicolas, about the lack of documentation, you meant the tools in the processing toolbox [0] or the pyQGIS cookbook [1]. I'm not sure there's anything missing in the former (and maybe Paul could find some answers) and, for the latter (which is horribly outdated), it's the usual lack of skilled people to provide necessary documentation. Because some parts of the docs are specialized, they require advanced users to help us update. If we are giving a txt (or whatever open format) file updating the section, I'm happy to push it and update that page too.

[0] https://docs.qgis.org/testing/en/docs/user_manual/processing_algs/qgis/networkanalysis.html
[1] https://docs.qgis.org/testing/en/docs/pyqgis_developer_cookbook/network_analysis.html

Regards,
Harrissou
For those reasons, I went with NetworkX python library.  Out of curiosity, how many edges are you dealing with? How many queries?

Nicolas





Le 16 sept. 2019 à 08:03, Paul Wittle <paul.wittle at dorsetcouncil.gov.uk<mailto:paul.wittle at dorsetcouncil.gov.uk>> a écrit :
Hi,

I’m aware that you can use things like the pgRouting plugin for shortest path calculations but when looking at the default functions is there a sensible way to speed up the calculations?

I’ve just run a couple of tests using an Oracle database based routing layer and it runs but seems to take a long time to build the graph. I wondered if there is a plugin which stores some sort of optimised network to speed up the process or perhaps a type of index I could put on the network?

At present the network is big so I guess perhaps some form of clip then run process might be helpful?

I just thought I’d email to see what others do as I’ve not looked at routing in QGIS for some years now and I’d prefer to avoid more complex options such as pgRouting if possible.

Thanks,
Paul
This e-mail and any files transmitted with it are intended solely for the use of the individual or entity to whom they are addressed. It may contain unclassified but sensitive or protectively marked material and should be handled accordingly. Unless you are the named addressee (or authorised to receive it for the addressee) you may not copy or use it, or disclose it to anyone else. If you have received this transmission in error please notify the sender immediately. All traffic may be subject to recording and/or monitoring in accordance with relevant legislation. Any views expressed in this message are those of the individual sender, except where the sender specifies and with authority, states them to be the views of Dorset Council. Dorset Council does not accept service of documents by fax or other electronic means. Virus checking: Whilst all reasonable steps have been taken to ensure that this electronic communication and its attachments whether encoded, encrypted or otherwise supplied are free from computer viruses, Dorset Council accepts no liability in respect of any loss, cost, damage or expense suffered as a result of accessing this message or any of its attachments. For information on how Dorset Council processes your information, please see www.dorsetcouncil.gov.uk/416433<http://www.dorsetcouncil.gov.uk/416433>
_______________________________________________
Qgis-user mailing list
Qgis-user at lists.osgeo.org<mailto:Qgis-user at lists.osgeo.org>
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
_______________________________________________
Qgis-user mailing list
Qgis-user at lists.osgeo.org<mailto:Qgis-user at lists.osgeo.org>
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
This e-mail and any files transmitted with it are intended solely for the use of the individual or entity to whom they are addressed. It may contain unclassified but sensitive or protectively marked material and should be handled accordingly. Unless you are the named addressee (or authorised to receive it for the addressee) you may not copy or use it, or disclose it to anyone else. If you have received this transmission in error please notify the sender immediately. All traffic may be subject to recording and/or monitoring in accordance with relevant legislation. Any views expressed in this message are those of the individual sender, except where the sender specifies and with authority, states them to be the views of Dorset Council. Dorset Council does not accept service of documents by fax or other electronic means. Virus checking: Whilst all reasonable steps have been taken to ensure that this electronic communication and its attachments whether encoded, encrypted or otherwise supplied are free from computer viruses, Dorset Council accepts no liability in respect of any loss, cost, damage or expense suffered as a result of accessing this message or any of its attachments. For information on how Dorset Council processes your information, please see www.dorsetcouncil.gov.uk/416433
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20190917/2cda7c6a/attachment.html>


More information about the Qgis-user mailing list