New route problem

2089
4
09-27-2010 03:08 PM
NagendraDhakar
New Contributor
Hello,
I am new to network analyst, so having some trouble working with it.
I have some GPS points and want to construct the corresponding route. So, I started with exporting my GPS points to ArcMap and then used 'new route', and 'add locations' sequentially to snap my GPS points to the network. Till this point, everything seems alright but after this I don't know how to proceed. I also solved my route and got the route consisting all GPS points. This route gives me total length and doesn't get any attributes from the network.
In my network I have few attributes, such as no. of lanes, functional class etc. and for my new route I want to find some coverage statistics such as, % of 2 lanes, 3 lanes.., % of functional class = 1, 2, 3 etc. Is there a way to get attributes from the network so that I can calculate some of these statistics for my route?

Thanks
Tags (2)
0 Kudos
4 Replies
JaySandhu
Esri Regular Contributor
So it sounds like you can solve the route but need to analyze the results more.
One way can be to spatially select all the roads that overlap your route and then summarize them and the other can be to add the "traversal" results being stored in memory as a feature class to ArcMap and summarize them. The traversal results has every edge of the route with its network attributes. You can use the following link to see how to access the traversal result:

http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#//000100000245000000

Jay Sandhu
0 Kudos
NagendraDhakar
New Contributor
Thanks a lot.

So it sounds like you can solve the route but need to analyze the results more.
One way can be to spatially select all the roads that overlap your route and then summarize them and the other can be to add the "traversal" results being stored in memory as a feature class to ArcMap and summarize them. The traversal results has every edge of the route with its network attributes. You can use the following link to see how to access the traversal result:

http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#//000100000245000000

Jay Sandhu
0 Kudos
NickDeMerchant
New Contributor
Hi Jay,

I saw your post on this and was wondering if the only way to get at the traversal result is through ArcObjects?

I am using the closest facility analysis and am building a process through model builder.  I would like a way to output to a traversal result layer for each route that is created through the closest facility process.

Thanks for your help.

Nick




So it sounds like you can solve the route but need to analyze the results more.
One way can be to spatially select all the roads that overlap your route and then summarize them and the other can be to add the "traversal" results being stored in memory as a feature class to ArcMap and summarize them. The traversal results has every edge of the route with its network attributes. You can use the following link to see how to access the traversal result:

http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#//000100000245000000

Jay Sandhu
0 Kudos
DeeleshMandloi
Esri Contributor
Nick,
  With ArcGIS 10 (and earlier versions), the traversal result can be accessed only via ArcObjects. However, you can use a trick to add the traversal result as feature layers in ArcMap and then use the feature layers in Model Builder with any geoprocessing tools that work with feature layers. For this to work,

  1. In ArcMap, create a new VBA macro and copy this VBA code in the macro body.

  2. 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
    

  3. Solve the Closest Facility layer and then run the macro. This will add two layers "Edges" and "Junctions" to ArcMap. The layer represents the edges and junctions traversed while finding routes.

  4. Move these two layers below the Closest Facility layer in Table of Contents (TOC). This will ensure that the traversal layers are not broken when you reopen the map document.

  5. Save the map document.

  6. The traversal layers can be used in Model builder with any gp tools. Every time the Closest Facility layer is solved, the traversal layers are updated.


Some caveats to keep in mind

  • The traversal layers are associated only with the existing closest facility layer. Any time you create a new layer, you need to remove the existing traversal layers and rerun the macro to create new layers.

  • In your GP model, you need to re-use the same closest facility layer. Since there is no way to edit properties of existing closest facility layers using GP(a tool or via python), you cannot change any analysis properties (such as number of facilities to find) in your model. However, You can change them from layer properties in ArcMap.

  • Any time the solve fails to find a solution, the traversal layers are removed from the TOC. So you need to rerun the macro to add the traversal layers after a successful solve.

  • As the traversal layers are just available in the TOC, you have to run the GP model from inside the map document containing the traversal layers.


And hopefully some good news, at 10.1, the network analyst toolbox will have a new GP tool that takes a network analysis layer and saves the traversal layers as feature classes on disk avoiding all these issues.

Hope this helps
Deelesh
0 Kudos