I want to run a custom tool created with the Model Builder in ArcGIS. It needs to output to the SAME file each time it runs, just adding the data. Basically I have a custom Dissolve tool that will dissolve (in this case) counties together based on user selection. I need a single file containing ALL the dissolved final shapes, but the Model Builder complains unless each output file is unique. Is there anyway around this or do I have to create dissolve_1, dissolve_2, etc... (to 500 or so) and then combine them afterwards?
2 Answers
It seems to me like the easiest way to accomplish this task is to
- create a new empty output layer/feature class,
- dissolve the multiple inputs to a scratch (or better yet, an in_memory layer) and,
- APPEND or MERGE them together into your designated output file.
-
Append was what I was looking for. Missed it somehow. Thanks.– JoshCommented Jul 18, 2013 at 17:40
One method to create unique names in Model Builder is to add %n%
into the output parameter. In your case, the proper usage would be dissolve_%n%
For example
Or if you would like to create unique names by list position, use %i%
Reference: Examples of in-line variable substitution with ModelBuilder system variables
-
My understanding of this is that it only works if you use a Loop. Running the tool multiple unique times would create an error as it resets to 0 (and therefore the name is Buffer0 each time).– JoshCommented Jul 18, 2013 at 17:19
-
I'm not sure how to get access to this in model builder (it may not be possible), but Create Unique Name would solve this issue.– PaulCommented Jul 18, 2013 at 17:28
-
@Josh, so you need a tool that searches for the last unique name in the run (e.g. dissolve_4) and names the new output "dissolve_5"...? How about list position %i%?– Aaron ♦Commented Jul 18, 2013 at 17:38
-
That might have worked. The simplest way to deal with my problem was in the answer by Ryan - append to an already existing file.– JoshCommented Jul 18, 2013 at 17:41