Calculating Shortest Paths for Individual Rows in Large Network Dataset

772
5
09-04-2023 10:41 PM
JiříKomínek
New Contributor III

I need help with network analysis on the Esri Community forum. I have a table with 100,000 rows describing routes from point A to point B. Each route is described by starting and ending coordinates. I also have a prepared network dataset, and I need to calculate the shortest path along the line for each row. I tried using "cos matrices," but it combines all the rows.

 

tables.png

Tags (2)
0 Kudos
5 Replies
MelindaMorang
Esri Regular Contributor

Happy to help with this.

As you've discovered the OD Cost Matrix is useful when you want to calculate the travel time and distance between all origins and all destinations or between all origins and the closest k destinations or all destinations within some cutoff.  It's not the right tool to use if you have preassigned origin-destination pairs.

You can use the Route solver to handle preassigned origin-destination pairs.  You have to make sure each origin and destination are assigned to the same route.  You can use the RouteName field in the input Stops for this.  All stops with the same RouteName value end up on the same route.  Let's say, for example, you have rows for stops A, B, C, and D.  A is assigned to B, and C is assigned to D.  You should create a RouteName field and give the rows for A and B a RouteName value of A-B and rows C and D a RouteName value of C-D, or something like that. The Route solver will generate two separate routes, one from A to B and the other from C to D.

Since the number of routes you have is pretty large, you may benefit from this downloadable toolset: https://github.com/Esri/large-network-analysis-tools  One of the tools in there is intended to solve large problems with preassigned OD pairs exactly like you're describing.

JiříKomínek
New Contributor III

Thank you very much! I will try it tonight. I read quickly documentation and it looks like what i need.

0 Kudos
JiříKomínek
New Contributor III

thanks I tried the tool, but instead of the shortest path between points I got the longest possible distance 🙂 I don't know why, but this is not quite the right calculation. I tried it with only 4 points for a sample, OD COS Matrix gives a realistic result.

 

route.png

0 Kudos
MelindaMorang
Esri Regular Contributor

What network dataset are you using?  Is it one you created yourself?  Usually when I see routes like this, it's a symptom of a network dataset connectivity problem or a problem with the way the cost attributes are configured.  The Route solver will always return the "shortest" path, but if the cost attributes are returning incorrect values, the shortest path calculation will also be incorrect.  Or, if there is no connection between roads at intersections, the shortest path may be to travel very far until it finds a usable connection.

0 Kudos
MelindaMorang
Esri Regular Contributor

I've actually recently been doing some research regarding preassigned origin-destination pair problems.  I know this is a common workflow, and my team would like to find a more convenient workflow.  If you have a few minutes and are willing, could you fill out the attached survey and return it to me?  This would be very helpful in helping us understand user needs so we can design something better in the future.  Thanks! 

0 Kudos