Make Feature Layer within a model does not add the layer

6376
20
Jump to solution
05-13-2021 01:15 PM
Labels (2)
RandyMcGregor3
Frequent Contributor

If I run Make Feature Layer as a tool, the new layer is added to my map. If I put the tool in a model and run the model ('Add to Display' is selected), The layer never appears.

If I open the model and run it, the layer is added to the map, but they are in an awkward group called 'ModelBuilder' and have a prefix I don't want them to have.

I would like to run the model as a tool and when I do that, nothing gets added to the map.

Is there something I can do to make the created layers visible?

Thank you,

Randy McGregor

0 Kudos
20 Replies
RandyMcGregor3
Frequent Contributor

That is what I did, but I had to add the layers after. Is there an 'Add Data' tool? I haven't seen one. Thank you!

0 Kudos
JayantaPoddar
MVP Alum

Not a GP tool, but the one in the ribbon (Add Manually).

JayantaPoddar_0-1621025169312.png

 



Think Location
0 Kudos
RandyMcGregor3
Frequent Contributor

Got it. Thank you very much.

0 Kudos
JayantaPoddar
MVP Alum

Just a query.

Split by Attribute tool also generates similar outputs that you are trying to achieve. Any particular reason why you are creating a model for this?



Think Location
0 Kudos
RandyMcGregor3
Frequent Contributor

I am trying to avoid creating separate feature classes. I might end up going with that tool if creating separate layers can't be done in a way that is useful.

Thank you!

Randy

0 Kudos
PhilipMarty
Regular Contributor

So, is this actually solved if there is no way to "Add Data" dynamically? Is the answer that "It is not possible to add the layers to the TOC when running the model as a GP tool"? I have a raster model that I would like to add the output of "Make Raster Layer" following an "Iterate Raster" function, and I cannot find a way to make it work. Any help would be appreciated.

0 Kudos
RandyMcGregor3
Frequent Contributor

I view, 'Solved' as, 'The question has been answered.' I don't like calling it 'Solved,' but people who answer the question deserve credit.

The difficulty in adding layers to the TOC when using an iterator is a frustrating limitation of the software, I agree.

0 Kudos
PhilipMarty
Regular Contributor

I appreciate the explanation. I totally agree it's sort of a shocking limitation of the software that adding model outputs from the GP window or ArcPy doesn't work better. Is there any alternative workflow? I have a very basic iterate raster, apply symbology, add to map model that I'm trying to add to an ArcPy script, so just curious if there's anything out there before I go down re-creating from scratch in python.

0 Kudos
RandyMcGregor3
Frequent Contributor

You can add layers via arcpy but it's more complicated than it seems like it should be. I don't have examples handy. I'll check and send you some if I find some. If you google 'Load layers into TOC with arcpy' you'll get some examples I think. Several steps are involved and it's a bit hairy.

0 Kudos
RandyMcGregor3
Frequent Contributor

'Layer' means many things in ArcGIS 🙂

0 Kudos