How iterate rasters using parse path in a complex model in Model Builder?

2770
5
01-12-2017 11:37 AM
ThallitaOliveira
New Contributor

Hello.

I have a complex model (with many tools/steps chained - named from "a" to "p") and I need iterate two input rasters (p1.img and p2.img), so that all the model outputs returned for the two input files. As there are many chained steps on the model, I applied the Parse Path output as a in-line variable substituition. My attempts and the problem were:

1) Multivalue iterator: return the outputs correctly but just in relation the file p1.img, doesn't run for the file p2.img. (image below)

2) Raster iterator: generate a kind of loop, running repeatedly and cumulatively outputs in relation of the file p1.img. (image below)

3) Turn the raster iterator and parse path tools as a submodel and add it into a main model that contain the steps:  return the outputs correctly but just in relation the file p1.img, doesn't run for the file p2.img. (image below)

Questions:

- How run all the model steps for both input files p1 and p2?

Suspect:

- I suspect that the problem is the Parse Path tool, that in some way limit the model to run upon the first file (p1) only.

Can someone help me solve this?

0 Kudos
5 Replies
ChrisDonohue__GISP
MVP Alum

Assuming both rasters are in one folder, I would think Iterate Rasters would be the way to go, and that using Name that is derived from the Iterate Rasters (as an inline-variable %Name%) would obviate the need for Parse Path.

So to start, I would troubleshoot why the Iterate Rasters is running as a loop. 

  • Do a new simple test model with Iterate Rasters pointed at your two images and see if the endless looping behavior repeats.
  • Check the Model Properties with your original models to see if any settings have been applied there that may be controlling the iteration behavior.  In the Edit view, Model, then choose Model Properties.

Chris Donohue, GISP

ThallitaOliveira
New Contributor

Hi Chris.

Thank you for the return. I add the Parse Path tool because my model have multiple steps chained, in which the results of one step are the input data of the subsequent ones, and so on. If I use only the inline variable %name%, I got this error:
Executing ((a) Int): Int C:\FT2\p1.img C:\FT\ap1.img
Succeeded 
Executing ((b) Raster to Polygon): RasterToPolygon C:\FT\ap1.img C:\FT\bp1.img.shp NO_SIMPLIFY Value
ERROR 010157: Unable to open feature class C:\FT\bp1.img.
Failed to execute ((b) Raster to Polygon).
That is, from the step "a" to the step "b", the model retain the extension .img of the name. For this reason, I used the Parse path, which permits that the input/output file names pass from a step to another without their extension.
I did what you suggested, simplifying my model to only first two tools (a and b) and run the model with Raster Iterator and Parse Path, and it works perfectly as I expected (see the figure). Now remains the question: why with all the tools/steps both raster and multivalue iterators does not work?
p.s.: I check the Model properties and the settings are the same as figure you posted.
0 Kudos
SteveLynch
Esri Regular Contributor

BUG-000095577 RasterToPoint, RasterToPolygon and RasterToPolyline when run in Modelbuilder the second time appends .shp to the output featureclass name and fails to run.

is fixed in ArcGIS 10.5 and ArcGIS Pro 1.3+

-Steve

ThallitaOliveira
New Contributor

Hi Steve.

After your answer, I tested the model in ArcGIS 10.5 (trial version), and got the same problem ... In fact it seems to be a bug, because even in version 10.4.1 (before your answer), I built the model from begin again, adding the iterator, parse path, and the other tools, and the model worked perfectly (that is, running the steps for the two files p1 and p2) until a certain moment. After that, it started to run only for file p1, endless.

0 Kudos
ThallitaOliveira
New Contributor

So, what to do if even on the ArcGIS 10.5 the problem does not disappear? 

0 Kudos