Mergin select result of multiple inputs

373
7
07-31-2013 10:06 AM
JuanPerez4
New Contributor
Hi,

I need, without python, merge the result of the select and buffer tools into a unique element for after generate a unique buffer. For better explication, I've attached an image. I want a unique shape (or feature class) buffer, but in the model that I've attached, the result are multiple files.

[ATTACH=CONFIG]26356[/ATTACH]

Thanks
0 Kudos
7 Replies
JuanPerez4
New Contributor
Anyone know how merge the buffers? Please, i need help :(
0 Kudos
StefanoMauri
New Contributor II
Hi, why don't you consider to iterate feature classes instead of use multiple inputs?
You can write every partial result in a scratch GDB and then append all to a new fc.
0 Kudos
JuanPerez4
New Contributor
Hi, why don't you consider to iterate feature classes instead of use multiple inputs?
You can write every partial result in a scratch GDB and then append all to a new fc.


The GP is for publicate on AGS. I don't know how many layers I will have in the input, for it I use a multiple inputs. The inputs can be 1, 2, 5... of the layers published, but repeat, I don't know how iterate it without list of values. If I iterate feature classes, I will select all layers published, and for each layer I need a filter (expression)

Thanks for your response.
0 Kudos
JuanPerez4
New Contributor
Nobody knows how? I'm desperate... :(
0 Kudos
RichardFairhurst
MVP Honored Contributor
Nobody knows how? I'm desperate... :(


Put all of the outputs of the buffer into the Merge tool, then the Dissolve tool if you want the buffers to become one giant feature.

Also, are you sure you want to use Select?  Are you using Coverages or shapefiles/geodatabases?  Probably you really want to first create an empty polygon feature class with the correct Spatial Reference and output fields you will want to Dissolve your buffers on.  Then make a model that Iterates Feature Classes (shapefiles) in a directory (See also this link)  outputting the feature class to the Make Feature Layer tool, then the Select Layer By Attributes tool, then the Buffer tool, then the Append tool to the empty feature class with the No Test option to fill it with all of the buffers.  You should set the overwrite outputs environment option to permit overwriting so that the Buffer tool overwrites its output with each iteration.  Don't worry, the Append will save the buffer results before the file is overwritten by the next iteration.  Then in another model input the prior model's Appended polygon output feature class into the Dissolve tool using a nested model approach to create a single giant feature from all of the buffers (if that is what you want).

A final alternative approach is to do no selection of the original shapefiles initially and just input all of them to the Merge tool to create a single feature class (assuming all of the inputs are based on the same geometry), then use the Merge output with the Make Feature Layer tool, then the Select Layer by Attribute tool, and finally the Buffer tool with the Dissolve Type All option set (if you do not want to preserve attributes) or List Option if separate shapes are to be preserved based on an attribute that should not combine.  This approach avoids the need for the Dissolve tool.
0 Kudos
JuanPerez4
New Contributor
Put all of the outputs of the buffer into the Merge tool, then the Dissolve tool if you want the buffers to become one giant feature.

Also, are you sure you want to use Select?  Are you using Coverages or shapefiles/geodatabases?  Probably you really want to first create an empty polygon feature class with the correct Spatial Reference and output fields you will want to Dissolve your buffers on.  Then make a model that Iterates Feature Classes (shapefiles) in a directory (See also this link)  outputting the feature class to the Make Feature Layer tool, then the Select Layer By Attributes tool, then the Buffer tool, then the Append tool to the empty feature class with the No Test option to fill it with all of the buffers.  You should set the overwrite outputs environment option to permit overwriting so that the Buffer tool overwrites its output with each iteration.  Don't worry, the Append will save the buffer results before the file is overwritten by the next iteration.  Then in another model input the prior model's Appended polygon output feature class into the Dissolve tool using a nested model approach to create a single giant feature from all of the buffers (if that is what you want).

A final alternative approach is to do no selection of the original shapefiles initially and just input all of them to the Merge tool to create a single feature class (assuming all of the inputs are based on the same geometry), then use the Merge output with the Make Feature Layer tool, then the Select Layer by Attribute tool, and finally the Buffer tool with the Dissolve Type All option set (if you do not want to preserve attributes) or List Option if separate shapes are to be preserved based on an attribute that should not combine.  This approach avoids the need for the Dissolve tool.



Thanks for your reply.

Te input features can be lines or point, not are based on the same geometry....
If I put de multi-outputs buffer on Merge tool, the output is multiple too...

I use Select tool because I need execute a filter (passed by the user) over the layer (passed by the user too), then create a buffer of selected elements
0 Kudos
RichardFairhurst
MVP Honored Contributor
Thanks for your reply.

Te input features can be lines or point, not are based on the same geometry....
If I put de multi-outputs buffer on Merge tool, the output is multiple too...

I use Select tool because I need execute a filter (passed by the user) over the layer (passed by the user too), then create a buffer of selected elements


That makes no sense.  You must be using the tool incorrectly and need to break down the inputs as single layers to the Select and Buffer tool.  How does the user pass multiple layers in the first place?  Why would you let them pass multiple layers at all?  If you really have multple layers, break down the parameters into separate parts and feed each part into a separate Select and Buffer tool, not all of the parameters into a single instance of each tool as it appears you have done (that should not work anyway).

Screenshot the actual input dialog of the Merge tool.  It will combine multiple buffer inputs into one output file if configured correctly.  I believe you are configuring the tools incorrectly, but have not shown the screenshots of the tools configurations, so we can't help you.

My suggestions would be an alternative to the Select tool.  SQL selections work with Select Layer By Attribute just as well if not better than the Select tool (which I have never found a reason to use).

Do you actually need outputs of the selections as actual feature classes at all?  That is what the Select tool does.  If those are not needed outputs and you really only need the Buffers, don't use the Select tool.  Use my approach, which just creates feature selections on the original feature classes for the Buffer to operate on.  Only the Buffer tool would generate outputs for the Merge tool to operate on.

I can't create two inputs to the Select tool at all.  It only accepts one feature class if I do not use a parameter and just actual feature classes.  This also makes me beleieve you are using the tools and parameters incorrectly in your model.  What types are the input parameters?  Why are they acting as multiple layers inputs in the first place?  Whatever they are they need to change to not do that.  If they really are meant to be multiple inputs, they need to be iterated more than likely, not dumped directly into the tool, which is not configured to accept layer lists.
0 Kudos