Question

Find sequence of stops along Shortest Path


I used the ShortestPathFinder to generate the shortest path from a start point through a set of > 1,000 intermediate points to an end point. Therefore, the "From-To" line that is used as input to the ShortestPathFinder connects all of these points/stops. Only the intermediate points on the From-To line were set to be re-ordered and not the Start and End point. The ShortestPathFinder did output a "Path" line. Now, I simply want to figure out the sequence/order of these intermediate stops on the shortest path.

I have allowed for U-turns in the shortest path and there are many segments in the path that overlap one another as U-turns are allowed. Therefore, two points/stops at a very close geographic location can be at completely different orders/sequences along the shortest path from one another.

 

I tried several approaches already:

 

1) Use Chopper to convert all the vertices of the ShortestPath line to points, then Counter to order the points in a 'Count' attribute. This gives me the proper order/sequence of points along the shortest path. Now, I need to get the information from the attributes of the From-To line vertices (which are my actual stops along the route) - such as address or zip codes- onto these ordered points. For that I used both Spatial Filter/Spatial Relator to relate the shortest path points to the From-To line vertices but that did not carry over all the values in the 'Count' attribute and hence did not work.

 

2) Use measures. Use MeasureGenerator on the shortest path, then Point on Line Overlayer to spatially overlay the points of the From-To line to the shortest path and Measure Extractor to extract the measures of these points on the shortest path, and Sorter to sort by the _point_measure attribute. However, I am not sure whether this would work, as two points at very close geographic locations might get assigned the same or similar measure but be at completely different orders/sequences along the shortest path since U-turns are allowed. In this case they should be assigned completely different measures but sine they are very close spatially they would get assigned the same or a very close measure.

 

It's surprising why the ShortestPathFinder does not output the re-ordered sequence of stops on the From-To line as well in addition to the shortest path.

 

Any help would be greatly appreciated.


4 replies

Userlevel 2
Badge +12

Seems like a good suggestion (adding the sequenced points as output).

Please create a new Idea for this as it looks like a useful addition.

Userlevel 1
Badge +10

*Therefore, two points/stops at the exact same or a very close geographic location can be at completely different orders/sequences along the shortest path from one another.*

I'm not sure i can understand how the shortest path can visit the same geographic location twice at different points. Surely the shortest path would always visit two points in the same location at the same time?

*Therefore, two points/stops at the exact same or a very close geographic location can be at completely different orders/sequences along the shortest path from one another.*

I'm not sure i can understand how the shortest path can visit the same geographic location twice at different points. Surely the shortest path would always visit two points in the same location at the same time?

Yes, that's correct- the shortest path would always visit two points at the same location at the same time. I should rephrase my statement- its visiting the same geographic location (containing only 1 stop) at different times- not sure why.

This is an example of its traversal with x,y coordinates. It is going from south to north in the screenshot below, until it gets to node #132, after which it goes back south to the previous point again, and then goes north again. It has already visited the same node in step 130. Not sure why this would happen.

 

Two points at very close (but not the same) geographic locations to one another can, however, be at different orders/sequences along the shortest path due to U-turns.

 

 

Userlevel 4
Badge +13

Hi @sirneeraj How long did the translation take to run? 1000+ intermediate points is a very long From-To line. My guess is that the ShortestPathFinder didn't have enough iterations to find a shorter path. If you can send us your data please submit a case via https://www.safe.com/support/report-a-problem/

Reply