3

I need to run network analysis routing (to calculate distance) on pairs of points with barriers. I have 3 feature classes:

  • Origins

  • Destinations

  • Barriers

All 3 of which share a common unique ID field called [RouteName], (which has a data type of Long.)

The barriers represent culvert failures on a road network. I would like to calculate how much travel distance is added to get from the origin (on one side of the failure barrier) to the destination (on the other side of the failure barrier).

I have set up the routing problem and it solves the route for each set of points using all barriers along the network. I am trying to find a way to for the routing to look at each Origin, Destination, and Barrier set (sharing a common [RouteName] attribute) individually to calculate the route, while ignoring all other Origins, Destinations & Barriers on the road network For each routing solution, I only want to use one origin, one destination and one barrier.

I have a model set up that successfully routes for one [RouteName] set using the "Select Layer By Attribute" tool in Model Builder. I have attached photos of my current model and my test result for using the expression "[RouteName]=21" in the select Layer by attribute tool for my Origins, Destinations and Barriers. Current ModelSuccessful Routing

What I would like to do is be able to set the model to run through each "set" of [RouteName] (Origin, Destination, & Barrier all sharing the same value) and output/append that successful routing to a new feature class with the set's [RouteName} as an attribute. I'm assuming I have to use the For Iterator but I'm not quite sure how to use the inline variable to do so.

2 Answers 2

0

To perform this "manually" I suggest using a Definition Query on each of the 3 featureclasses. Use the unique ID of the "run" {i.e. the matching set of Source, Destination, and Barrier} as the definition query value so that only one "run" is displayed. Then perform the route calculation for this "run."

Once you have it working for one run; perform the analysis in a loop (either in ModelBuilder or using Python.) For each "run" id in the loop index:

  • Modify the Definition Query for all 3 FCs
  • Perform the route calculation
  • store the result in a run-specific output

At the end of the loop, you can merge the run-specific outputs to a single output if it is meaningful to you to display the combined output. Otherwise, just compose the outputs in a TOC to show all the "runs" on one map.

0

Assuming your ID's go from say 1 to 10, you can use the FOR Iterator to create an ID value that is used to select the origin, destination, barrier using the select by attribute tool. It is that selection that feeds into the rest of the model logic. You'll want to use the ID value to create unique route layers which you could merge into a single dataset if required.

Remember all geoprocessing tools honour selections!

6
  • So where, in the image of the model above, would I add the FOR iterator? Would iit iterate for all three point classes (origin/destination/barrier)?
    – cl3
    Commented Oct 14, 2020 at 17:35
  • Just add it, it would drive the rest of the model, it does not have to be connected. Refer to help file.
    – Hornbydd
    Commented Oct 14, 2020 at 19:03
  • If I add the For iterator, it still loads all of the 415 Origin, 415 Destination and 415 Barrier locations to the routing analysis, and solves using all. I only want to use one of each for each route analysis. Sorry if I sound clueless, I kind of am.
    – cl3
    Commented Oct 14, 2020 at 19:27
  • So you need to add to your model the select by attribute tool and select an origin by Id before you call add to location. Repeat for destination and barrier. So all three layers have a selection before you add and solve.
    – Hornbydd
    Commented Oct 14, 2020 at 19:35
  • Do I need to use an expression in the select by attribute tool? If I leave Expression blank, it still loads all stops an barriers. imgur.com/VT8HHUs
    – cl3
    Commented Oct 14, 2020 at 20:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.