merege

776
5
Jump to solution
01-31-2018 07:59 PM
jayasudha
New Contributor III

I am using iterate feature class to merge shape files, set workspace, used wild card, selected feature type and checked recursive option to iterate through all subfolders in workspace. But the tool is using shape file present in last folder out of 4 folders in workspace. The model is attached. Please suggest me why the model is not considering shape files in first 3 subfolders.

0 Kudos
1 Solution

Accepted Solutions
curtvprice
MVP Esteemed Contributor

Jaya -- you are missing the Collect Values "model only" tool to create a list to pass to the Merge tool. The way your model is structured now runs Merge four times, overwriting your output each time. That's why you're only seeing the last one. If your model has any complexity to it at all you may want to put this iterating step into a submodel, and pipe the collected list as an output parameter to supply to Merge in your main model.

Examples of using Model Only tools in ModelBuilder—Help | ArcGIS Desktop 

View solution in original post

5 Replies
DanPatterson_Retired
MVP Emeritus

Not sure what your parameters are since you have none defined, but merge requires an output name in your case a shapefile name, and a list of features to merge together to save to it

Merge_management (inputs, output, {field_mappings})

So your inputs are derived from the names of the files in the iterator and the output should be a filename.  Expose the parameter http://pro.arcgis.com/en/pro-app/help/analysis/geoprocessing/modelbuilder/model-parameters.htm

Or if you want to use another option (not recommended), you can append the files to an existing file using the Append tool in the model

jayasudha
New Contributor III

Thanks. I have used following settings in model. What parameters are to be defined and exposed ?

c:\modeldata\
folder1\poi.shp
folder2\poi.shp
folder3\poi.shp
folder4\poi.shp

iterate feature class settings
-------------------------------
workspace=c:\modeldata
wildcard=poi*
recursive=checked


merge tool settings
---------------------
input dataset: feature class link from iterator
output dataset: c:\modeldata\merge.shp

0 Kudos
curtvprice
MVP Esteemed Contributor

Jaya -- you are missing the Collect Values "model only" tool to create a list to pass to the Merge tool. The way your model is structured now runs Merge four times, overwriting your output each time. That's why you're only seeing the last one. If your model has any complexity to it at all you may want to put this iterating step into a submodel, and pipe the collected list as an output parameter to supply to Merge in your main model.

Examples of using Model Only tools in ModelBuilder—Help | ArcGIS Desktop 

curtvprice
MVP Esteemed Contributor

Jaya, by the way it's not too late to rename your thread from "merege" to something like "Using an iterator with the Merge tool". 

Just sayin.

0 Kudos
jayasudha
New Contributor III

Curtis Price, Thank you.

0 Kudos