Skip to main content

 

I have a question.

I have the network below, but I only have the data.

i want to know which section to go through to go from endpoint to endpoint.

 

in this example I want to get 3 answers.

which sections to go through to get from:

1) from 1 to 5

2) from 1 to 8

3) from 5 to 8

 

how can i solve this?examplethe solution should be:

1) sections 21,22,25,27

2) sections 21,22,25,26,23,24

3) sections 27,26,23,24

 

If you're somewhat fluent in Python you can implement this fairly easily using e.g. the Dijkstra shortest path algorithm in a PythonCaller: https://www.bogotobogo.com/python/python_Dijkstras_Shortest_Path_Algorithm.php

I've done this myself several years ago, I found it to be surprisingly efficient.

The alternative would be to create fictional lines in FME based on the CSV contents and sending it to the ShortestPathFinder. It's probably going to be slower, especially for large networks and/or a large number of paths to find.


This was fun! Creating fictional line segments was easy, but creating the from-to paths was surprisingly difficult. But then I may well have hugely overthought the problem, so hopefully some bright mind will come up with a much simpler solution.

SampleNetwork


If you're somewhat fluent in Python you can implement this fairly easily using e.g. the Dijkstra shortest path algorithm in a PythonCaller: https://www.bogotobogo.com/python/python_Dijkstras_Shortest_Path_Algorithm.php

I've done this myself several years ago, I found it to be surprisingly efficient.

The alternative would be to create fictional lines in FME based on the CSV contents and sending it to the ShortestPathFinder. It's probably going to be slower, especially for large networks and/or a large number of paths to find.

thanks. i looked into the phyton solution, but i have to learn a lot more before i can solve it.


This was fun! Creating fictional line segments was easy, but creating the from-to paths was surprisingly difficult. But then I may well have hugely overthought the problem, so hopefully some bright mind will come up with a much simpler solution.

SampleNetwork

thanks, this looks like a working solution. I will look into it next week.


thanks for the solutions, these work well with a simple network that i have offered. with an extended network it gives errors. can't find the problem. but my colleague was able to modify the source data so that it becomes easy to show the route. which solved the problem.

thank you all for your help.


Sorry to hear you didn't get it to work with more complex data.


Reply