Model Builder Iterator overwriting name error?????

3659
14
10-16-2015 09:35 AM
JustinMeyers
New Contributor III

I set up a model to iterate rasters and do a spatial analyst math int geoprocess.  i did a subset of my entire raster collection just to make sure it would work.  I have three rasters in a FGDB.  My output only had two rasters?  so I reran and had a different output.  same results.  I renamed the input rasters, same result?  Essentially the iterate is grabbing the last raster and naming the output the same as the first rasters output?????  Why is this happening?  See circled red boxes for exactly what is happening

0 Kudos
14 Replies
DarrenWiens2
MVP Honored Contributor

Are you using an inline variable to name the outputs?

0 Kudos
JustinMeyers
New Contributor III

yes i am.  that is why i am lost/ confused why it is trying to name/ write something that already ran/ exists

0 Kudos
DarrenWiens2
MVP Honored Contributor

It may help if we can see your model setup.

0 Kudos
JustinMeyers
New Contributor III
0 Kudos
KyleBalke__GISP
Occasional Contributor III

Darren is correct, you need to use inline variable substitution in the output name of your final raster.  The output name of your raster should look like the following:

C:\globeland30\rasters4_work2.gdb\%Name%

The %Name% part will use the name of each input raster to your iterator as the output file name.

Hope that make sense.

Kyle

0 Kudos
JustinMeyers
New Contributor III

yes, i have the model setup with that.  that is why I am confused why it is overwriting with a name that 1)it isnt and 2)that already ran

I am not sure if this is a bug?

0 Kudos
ZacharyHart
Regular Contributor

FWIW, I think you should have the 'What FGDB do you want' as a precondition before the iteration proceeds.

0 Kudos
JustinMeyers
New Contributor III

Zachary,

any idea why this is happening?

0 Kudos
ZacharyHart
Regular Contributor

I don't think file format has anything to do with this here.

I was able to get the model to work correctly. For what its worth, I changed they name of the variable to 'Output_FGDB'...I don't like using things with spaces or special characters (unlikely culprit). I made this a precondition, validated the model, saved, and then ran it through the catalog window. [I wish I used smaller rasters!].

Here is my model:

Test_Model.PNG

And here are the results:

Model_Results.PNG

0 Kudos