Question

ShortestPathFinder


Im have trouble getting ShortestPathFinder to work. I had a two large data sets of supply and demandpoints but now I have narrowed it down to only two points just to get to know how it works. With poor results. I use PointConnector and get the line  (se image, black line. Network grey lines). I have the snap option on eventhough the lines in the network reach the points. Does anyone have ANY tips or tricks regarding ShortestPathFinder I would be greatful.

 

/Caroline

 

 

 


11 replies

Userlevel 2
Badge +17
Hi Caroline,

 

 

Cannot find problems from the screenshot.

 

Adjoining lines belonging to a network have to be touched at their end nodes each other.

 

Do all the gray lines satisfy the condition?

 

 

Takashi
Userlevel 4
Hi,

 

 

I agree with Takashi, I cannot see any obvious problems.

 

 

However, have you looked at this article (https://knowledge.safe.com/articles/Samples_and_Demos/Find-the-Shortest-Path-Between-a-Start-and-End-Point)? In particular, there is a link to a video there on the ShortestPathFinder that might be of help.

 

 

David
Userlevel 4
On thing, though: it is theoretically possible that you lack vertices on some network intersections. Try sending the network lines through a TopologyBuilder first.

 

 

David
Thank you Takashi for your answer,

 

I have used a snapping tool to create the shorter lines in the network so they should touch. I tried with extending the lines where the to point are to be sure. This didnt work eituer. On the other hand if I created points in the large netwokr (red lines) at the intersection i did get a path...
Userlevel 2
Badge +17
Think of this simple example.

 

 

If the horizontal line consists of two individual lines in fact, which touch with the red point at their end nodes, the ShortestPathFinder treats the three lines (two horizontal lines and one vertical line) as a network.

 

 

But if the horizontal line is one single line A-C, the transformer will not treat it as a network, even if the line has a vertex at the point. Path between B and C can not be found by the transformer.

 

 

Again, the lines belonging to a network have to be touched at their END nodes each other. In other words, every line should be divided at intersection points. That's why vertex snapping is not enough but the TopologyBuilder could be effective, as David suggested.
Thank you Takashi for the explaination and thank you David for the Topologybuilder-tip. This helped me create a path for one line! Im now running my model with 1068 supply points and 842 demand points. I have a lot of noPaths so far but also the (good) Paths are ticking up as we speak. To be coninued.. :)
Userlevel 4
You might have to verify that all the network lines are properly connected, as mentioned by Takashi. Consider inserting an AnchordedSnapper at the very beginning:
  • Your "main" (red) lines as anchors
  • All the other lines as candidates
  • Snapping type: Segment snapping
You may have to experiment a bit to find a suitable tolerance (in ground units).

 

 

David
Thanks againt for you anwers!

 

I will try the AnchordedSnapper. menawhile, do you have any suggestion how to test if a network is useful for shortestpathFinder? The network Ive been asking about above is simple manually made (the red lines) and then snapping the point to it in order to make paths to the points. We have a more complicated network (roads) wich has a lot of gaps and dead ends. Its a mess really. We need a solif network to start with I guess, then we need to make sure all the lines are separated (as Takashi explained). Do you have any  suggastions on how to check errors in a network? maybe even how to fix them ... :). We have been using SmartCleaner. Does that do the trick? Can we check if the netwokr is compleatly fixed after that?

 

/Caroline
Userlevel 4
First of all, make sure to set "assume clean data" to No on the TopologyBuilder, this will help with overshoots. You could also try using the Intersector before the TopologyBuilder. But again, the AnchoredSnapper should make a noticable difference.

 

 

If you have the necessary license, the MRF2DCleaner can be very helpful when used with the "compute true intersections" and "compute fuzzy intersections" settings. But you will need a separate license for this transformer, though.

 

 

Other than that you can probably get a long way just by doing lots of random tests using the ShortestPathFinder and check that it actually produces something meaningful.

 

 

If you need to do more advanced checking, you could iterate over all the lines exiting the TopologyBuilder to check that _from_node and _to_node have been referenced in at least one other line segment.

 

 

David
Userlevel 2
Badge +17
You can also use the NetworkTopologyCalculator to check if all the lines belong to the same network.

 

The transformer adds network ID attribute (called "_network_id" by default) to output lines; if all output lines have the same network ID, you can say that they belong to the same network.

 

 

Note that the transformer just determines the topological connectivity of a network graph. There could be unpreferable gaps between lines even if they belong to the same network.

 

As David mentioned, you might need to go a long way of trial and error, depending on the data condition.
Thak you Takashi and David for the useful answers. We have made some inprovements but are still struggling with the network.

 

/Caroline

Reply