1

I am using ModelBuilder to iterate Closest Facility analysis for every building at an archaeological site (OD Cost Matrix is not what I need--I need the geometry output, not just a cost matrix table). My draft model is below. One question: at the end of the model, it takes the routes generated from the Closest Facility analysis and copies it to a new feature class. However, the Copy Features tool seems to require a specific name for the output. When I iterate to the next facility, it will either overwrite or break the model.

So the question is simple: how do I configure Copy Features tool to output the name from the corresponding iteration (taken form the ObjectID field from the Iterate Feature Selection)?

Current model

PolyGeo
65.5k29 gold badges115 silver badges349 bronze badges
asked Apr 8, 2015 at 15:30

1 Answer 1

3

In line variable substitution is what your looking for. You can use the 'Value' output from the iterate feature selection to uniquely label the output. In the Output Feature class in the Copy Features, use the %Value% to assign a different name for each iteration.

For example, set the output to [your output location]\%Value%'

See ESRI's help page for more info on how this works. Example 2 is what you want

answered Apr 8, 2015 at 15:47
3
  • Thanks, that's what I thought re: in line variable. But where do I actually place "%Value%"? The examples they give don't say where one actually places the in line variable in the tool. At least, I don't see it. I tried to do it by double clicking the output of Copy Features (the green oval on far right above) and replacing "New_test_03_" with "%Value%". It failed to write the feature class to the geodatabase. Commented Apr 8, 2015 at 16:04
  • Got it. I opened the output from copy features, and instead of only putting %Vale% as the output name, I put some leading text before %Value%. In this case, I used "Route_" (w/o quotes). Thus, "Route_%Value%" outputs Route_1 (iteration 1, ObjectID=1), Route_2 (iteration 2, ObjectID=2), Route 3 (iteration 3, ObjectID=3), etc.Thank you. Commented Apr 8, 2015 at 16:11
  • Actually, no. I get Error 000210 (Cannot create output) and Error 000354: The name contains invalid characters. Frustrating. Commented Apr 8, 2015 at 16:44

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.