Finding all links in a route

1078
13
08-19-2011 05:43 AM
AlistairFord
New Contributor
Hello,

I am trying to do something which I thought would be fairly straightforward but cannot seem to figure it out. I am simply trying to identify all the links in the source feature class which make up the shortest route calculated by Network Analyst. i.e. link the route output to the polyline inputs along which it traverses. Is there an easy way to do this? There doesn't seem to be any common ID between the routes output and the traversal results which make them up.

I have tried searching the traversal result table for the link with the Accumulated cost the same as the Total cost for the route, but despite the figures looking the same in the table, a search by attribute doesn't give me back the link.

Surely I'm missing something here? This doesn't seem like an unusual task to me!

Any help is greatly appreciated,

Alistair
Tags (2)
0 Kudos
13 Replies
JaySandhu
Esri Regular Contributor
The edges traversed by a route are kept in memory as a traversal result. You can access them via VBA or a C# addin. You can search the forums on "traversal result" for all these ways or use the following AddIn:
http://resources.arcgis.com/gallery/file/ArcObjects-.NET-API-Code-Gallery/details?entryID=C8A2186E-1...

Jay Sandhu
0 Kudos
AlistairFord
New Contributor
Hi Jay,

Thanks for your response. I guess I should have made my request clearer. I am attempting to determine all of the links which make up a route between a pair of origins and destinations, for a number of different pairs (1770 in total). I cannot use the OD Matrix as I need the actual routes, so I am running a closest facility solver. I can't chunk the network up as I need to keep the traversal results, so I'm running one origin to all destinations in a loop in .NET. What I need to know though, is which links form the route between each combination of origins and destinations. i.e. I find the route between origin A and destination B, and then determine which links (in the original source feature class) make up that route. And I need to do that for every route in the closest facility result. And I need to store these links in a list to look at later.

For example:

Route A to B is composed of link IDs 1,2,3,4,5,6,7,8
Route A to C is composed of link IDs 1,2,9,10,11
etc

I can't find a common ID to join the traversal result links to the route in the Closest Facility result, and thus to the original underlying feature class. Is this possible?

I hope this makes more sense!

Alistair
0 Kudos
JaySandhu
Esri Regular Contributor
The Edges table generated by the traversal result should have a field called RouteID. This is same as the ObjectID in the CF Routes table.

You should be able to simpy solve all your paths in a single CF and then generate the traversal result.

However I think you do not need all paths from incidents to facilities and that is why you are running CF in a loop for each "OD pair". In that case, CF is the wrong solver to use. Why not use the Route solver? You can load ALL the OD pairs with a common ROUTENAME and it will solve all 1770 routes and then run the traversal result once to get everything. If this is really what you need to do then search the forums on ROUTENAME and see how to use that to make the Route solver solve multiple OD pairs.

Jay Sandhu
0 Kudos
JamesSmith5
New Contributor
Dear Jay,

I have a similar problem here if you wouldn't mind providing some assistance?

http://forums.arcgis.com/threads/39825-Extract-TOIDs-from-route

I have used the closest facility tool to create routes between my 10 origins and 10 destinations, but I would now like to join some external data to each of the routes. The external data are pollen levels detected on road sections, and a level is given for each road segment and stored using a TOID. I need to, either spatially or using the TOID, sum the pollen levels that each route has taken. Does that make sense? So lets say a route has gone along road ID 1, 2 and 3 and that these roads in my 3rd party data have pollen levels of 10, 10 and 15, the result should be a field which is the sum of 10, 10 and 15.

By the way, I cannot find "The Edges table generated by the traversal result" ? Where is this?

Thanks

James
0 Kudos
JaySandhu
Esri Regular Contributor
If the street network data you are using is your own data, then you could add another impedance attribute based on the pollen values. Then solve the path but ACCUMULATE the pollen attibute. That is on the CF layer properties, there is an accumulation tab and you can check on the attributes you want to accumulate.

As far as where is the Edges table, normally it is in memory and not exposed. You have to run the traversal code as described in the AddIn you download and then it adds it to the ArcMap table of contents.

So you solve the CF and then run the AddIn. Once you have the Edges table, it has the OID of the streets. You can join it to that streets feature class and copy over your TOID to the edges table. Then you can Join it to your external table based on this TOID.

But the first suggestion, add your external pollen count to the streets table and use that to create an impedance attribute and then simply accumulate is the easiest.

Jay Sandhu
0 Kudos
JamesSmith5
New Contributor

So you solve the CF and then run the AddIn. Once you have the Edges table, it has the OID of the streets. You can join it to that streets feature class and copy over your TOID to the edges table. Then you can Join it to your external table based on this TOID.


Dear Jay,

I'm struggling with the bit in bold. I have the Edges table, and I know how to do joins, however I'm not quite sure what the 'streets feature class' is in my example. The original network that was used is from the Ordnance Survey in the UK so I have the following within my network:


  • Bridges

  • FerryNodes

  • Gates

  • InferredTurnRestrictions

  • mandatoryTurnRestrictions

  • MiniRoundabouts

  • MotorwayJunctions

  • NetworkDatasetJunctions

  • NetworkJunctions

  • PartialRestrictions

  • RisingBollards

  • RoadLinks

  • TrafficCalming

  • TurnRestrictions


I thought that I would join the Edges table that has been created using the addin, to the RoadLinks table from the original network, however the RoadLinks table does not contain the OID field. Please see the attached screenprint of my RoadLinks table.
0 Kudos
JaySandhu
Esri Regular Contributor
Bring up the properties of the RoadLinks feature class. Then click on the Fields tab. It should show you all the fields that are present in your feature class. See if any of them are un-checked to hide them from view when you open the feature class. Most likely the ObjectID field has been turned off. if that is the case, check it on and now the values should be visible.

Jay Sandhu
0 Kudos
JamesSmith5
New Contributor
Bring up the properties of the RoadLinks feature class. Then click on the Fields tab. It should show you all the fields that are present in your feature class. See if any of them are un-checked to hide them from view when you open the feature class. Most likely the ObjectID field has been turned off. if that is the case, check it on and now the values should be visible.

Jay Sandhu


Woohoo! Thank you Jay. I'm there now. I needed to join the field ObjectID in my network, with the SourceOID in the new edges dataset. I can now link my pollen counts through using this ID. Excellent. 🙂
0 Kudos
JamesSmith5
New Contributor
Hi Jay,

Sorry to bother you again, but do you know if there is some way to access the traversal add-in using the Python window...?

James
0 Kudos