[Qgis-user] help with shortest-path/network analysis (multiple origins to multiple destinations)

Ujaval Gandhi ujaval at spatialthoughts.com
Fri May 6 07:47:48 PDT 2022


You need to do Distance Matrix. See
https://www.qgistutorials.com/en/docs/3/origin_destination_matrix.html

On Fri, 6 May 2022 at 7:33 PM, Francesca Parente via Qgis-user <
qgis-user at lists.osgeo.org> wrote:

> Thank you very much indeed Nicolas, for your inputs and all the suggested
> materials!
> I have 50 targets and 532 origins. My goal is to define where is best to
> go within the 50 destinations for each starting point - given the actual
> range of choices though, so I'm not sure that running a batch one-to-many
> would take into account all the variables properly as a many-to-many would
> do. In the absence of a specific modelling, also some second best could
> work.
>
> I understand that your upstream-downstream-Dijkstra script is suitable for
> layer-to-layer indeed and I'm trying to run it, but at the >>> import
> geopandas as gpd<< line I got the following error message:
>
>
>
>
>
>
>
> *Traceback (most recent call last):  File
> "C:\OSGEO4~1\apps\Python37\lib\code.py", line 90, in runcode    exec(code,
> self.locals)  File "<input>", line 1, in <module>  File
> "C:/OSGEO4~1/apps/qgis/./python\qgis\utils.py", line 799, in _import    mod
> = _builtin_import(name, globals, locals, fromlist, level)*
> *ModuleNotFoundError: No module named 'geopandas'*
>
> I've been following your tutorial, but I admit I'm not quite familiar with
> py. I've gone through the remaining import coding and it seems working, but
> I'm not sure the "geopandas" module is needed or not to properly complete
> the script.
>
> Thanks again!!
> Best,
> Francesca
>
> Il giorno gio 5 mag 2022 alle ore 22:28 Nicolas Cadieux <
> njacadieux.gitlab at gmail.com> ha scritto:
>
>> Hi,
>>
>> How many shortest path calculations are you looking at? You could
>> probably do a all pairs shortest path dijkstra and filter the results.  You
>> could batch multiple one to many (point to layers)  In QGIS using the
>> processing plug-in.
>>
>> I did create an algorithm using networkX that could be modified to work
>> with two input layers.  This could be useful if QGIS is not fast enough or
>> if you have too many routes to calculate.  You will find it in the links
>> below. Keep in mind this algorithm was for rivers therefore you have no
>> trafic rules.  This would need more work.
>>
>> You will also find an article we wrote in Data that may help.  If you
>> have trouble with the network, look in the QGIS hub for the models. Look
>> for the 3 “fix directional networks models”.
>>
>> I added a few YouTube videos I made.
>>
>> https://gitlab.com/njacadieux/upstream_downstream_shortests_path_dijkstra
>>   <https://www.mdpi.com/2306-5729/5/1/8>
>>
>> https://www.mdpi.com/2306-5729/5/1/8
>>
>> https://plugins.qgis.org/models/
>>
>> https://youtu.be/v61PafSByvM
>>
>> https://youtu.be/qQrHcKtmr3o
>>
>>
>> Nicolas Cadieux
>> https://gitlab.com/njacadieux
>>
>> Le 5 mai 2022 à 10:38, Francesca Parente via Qgis-user <
>> qgis-user at lists.osgeo.org> a écrit :
>>
>> 
>> Hello everyone,
>>
>> I'd need to identify optimal destinations (within a point layer of
>> geolocated facilities) for each territory of a given set of possible
>> origins.
>> I already calculated a distance matrix between the two point-layers, and
>> also applied the distance-to-nearest-hub tool to generate a string layer
>> and identify the optimal facilities.
>> But I'd like to obtain a more realistic estimate, accounting for the
>> roads network (and ideally their travel times). With quite a few issues, I
>> finally managed to import an OSM road network from download.geofabrik.de
>> (in order to cover my area of interest, I had to merge two different
>> vectors fo Center and Southern Italy and then extract a focus spot in
>> between the two and save it as a lighter layer, otherwise it also took an
>> eternity to run every analysis).
>>
>> So now my question would be: is there a tool to perform a layer-to-layer
>> shortest-path analysis that takes it into account?
>> All that I could find was either point-to-point or
>> layer-to-point/point-to-layer (I looked also at built-in network analysis
>> tool and Qneat3 plugin).
>>
>> Any kind of inputs and suggestions will be more than welcome!
>> Thanks a lot for your support and have a good day,
>> Francesca
>>
>> --
>> ----------------------------
>> Francesca Parente
>>
>> _ SESS Euro PhD
>> <https://phd.uniroma1.it/web/FRANCESCA-PARENTE_nT1602922_IT.aspx> in
>> SocioEconomic and Statistical Studies
>> _ Luiss SEP <https://sep.luiss.it/> School of European Political Economy
>>
>>
>> email: francescaparente.rse at gmail.com
>>        parentef at luiss.it
>>
>> _______________________________________________
>> Qgis-user mailing list
>> 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
>>
>>
>
> --
> ----------------------------
> Francesca Parente
>
> _ SESS Euro PhD
> <https://phd.uniroma1.it/web/FRANCESCA-PARENTE_nT1602922_IT.aspx> in
> SocioEconomic and Statistical Studies
> _ Luiss SEP <https://sep.luiss.it/> School of European Political Economy
>
> email: francescaparente.rse at gmail.com
>        parentef at luiss.it
>
> _______________________________________________
> Qgis-user mailing list
> 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
>
-- 
[image: Logo] <https://spatialthoughts.com/>
Ujaval Gandhi
Spatial Thoughts
mobile: +91-8095684687
email: ujaval at spatialthoughts.com
[image: LinkedIn icon] <https://www.linkedin.com/in/spatialthoughts/>  [image:
Twitter icon] <https://twitter.com/spatialthoughts>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20220506/07e29168/attachment-0001.htm>


More information about the Qgis-user mailing list