Overlapping routes in Closest Feauture

1714
6
01-05-2011 12:28 PM
Highlighted
New Contributor
Hello everybody. My first post in forum. I am a student network engineering and my diploma thesis needs arcgis. let me explain you in a few lines.

I have some building blocks (~400 blocks) [polygons] and street segments (~1000) [polylines] around them. I take random points (~7000) in the blocks and with Network Analyst and Closest Feauture I create new network dataset and take the shortest paths from a central point (Facility) to the 7000 points (Incidents). As a result 7000 routes [polylineM] are generated. My question is how can I find how many routes cross every street segment.

Here is what I' ve done: I make dissolve for the routes (with no fields and not check the button create multipart feautures) and I get a dissolve_routes [polylineM] shape with mutual street segments (~650 segs) but without counting the routes as I wanted.

So, later I made Spatial Join the dissolve_routes (buffer of dissolve_routes) with all the routes to take the join_count field. However it never finishes (I left it for a day and no result). I also tried to take the spatial joins of the routes and the dissolve_routes_points (central x/y points of them)  but the result was the same. Any ideas..?

One idea was to reduse my elements, but I want to have large regions with points up to ~50.000.
Any ideas would be helpfull. Thanks, John.
Tags (2)
Reply
0 Kudos
6 Replies
Highlighted
Esri Regular Contributor
When you solve the closest facility (or route), the resulting output contains one line feature per route and do not contain the individual edges that made up that route. However, that information is available in memory in form of a traversal result and can be accessed to turned into line features. Once you have that, you can simply summerize on the source object id and find out how many times each edge has been traversed. You can use the following resource to add the traversal result right after you solve the CF to the ArcMap TOC:

http://resources.arcgis.com/gallery/file/arcobjects-net-api/details?entryID=C8A2186E-1422-2418-3494-...

Jay Sandhu
Reply
0 Kudos
Highlighted
New Contributor
Thanks for the reply. I have arcgis 9.3. I saw that addin can be installed on version 10. Any tip?
Reply
0 Kudos
Highlighted
Esri Regular Contributor
If you have 9.3, then you can use the following VBA and run it after you solve the Closest Facility. It will add two new feature classes representing the lines and junctions that were traversed.
Regards,
Jay Sandhu

Public Sub AddNATraversalResultToArcMap()
  Dim pMxDoc As IMxDocument
  Dim pNetworkAnalystExtension As INetworkAnalystExtension
  Dim pNALayer As INALayer
  Dim pFLayer As IFeatureLayer
  Dim pTraversalResultQuery As INATraversalResultQuery
  Dim pNATraversalResultEdit As INATraversalResultEdit
 
  Set pMxDoc = ThisDocument
  Set pNetworkAnalystExtension = Application.FindExtensionByName("Network Analyst")
  Set pNALayer = pNetworkAnalystExtension.NAWindow.ActiveAnalysis
  Set pTraversalResultQuery = pNALayer.Context.Result
  Set pNATraversalResultEdit = pTraversalResultQuery
 
  'Infer Geometry
  pNATraversalResultEdit.InferGeometry "", Nothing, New CancelTracker
 
  'Get the Edges and add as a layer
  Set pFLayer = New FeatureLayer
  Set pFLayer.FeatureClass = pTraversalResultQuery.FeatureClass(esriNETEdge)
  pFLayer.Name = pFLayer.FeatureClass.AliasName
  pMxDoc.FocusMap.AddLayer pFLayer
 
  'Get the Junctions and add as a layer
  Set pFLayer = New FeatureLayer
  Set pFLayer.FeatureClass = pTraversalResultQuery.FeatureClass(esriNETJunction)
  pFLayer.Name = pFLayer.FeatureClass.AliasName
  pMxDoc.FocusMap.AddLayer pFLayer
End Sub
Reply
0 Kudos
Highlighted
New Contributor
After copy / paste your code in Visual Basic Editor and run it I get Edges and Junctions layers but when I open the attributes tables I get no objects. Is there sth on your code I had to change? I am totally newbie at VBA..
Reply
0 Kudos
Highlighted
Esri Regular Contributor
Did you solve the closest facility just before running the VBA? i.e. if it is an existing map document or layer that has been solved in a previous ArcMap session then there will be no traversal results still in memory for the VBA to access.

Jay Sandhu
Reply
0 Kudos
Highlighted
New Contributor
You re right. I had the routes from previous run. thanks.
Reply
0 Kudos