Many Lyr files in a folder to one new lyrfile - Possible in modelbuilder?

201
2
09-01-2021 12:44 AM
JohnnyJohansson
New Contributor III

Many Lyr files in a folder to one new lyrfile - Possible in modelbuilder?

I have 4000 folders with 11 lyrfiles in each, with their own symbology.

I need to create one lyr file for each folder with all the 11 lyrfiles as input.

 

Any ideas to do this? 

I'm using Desktop 10 and have, but not used PRO yet...

-Nope, I can't script in python... Cuz I dont have the knowlage... 

0 Kudos
2 Replies
David_Brooks
MVP Regular Contributor

@JohnnyJohansson , I don't believe this can be done in Model Builder, as you need the arcpy.mapping functions to manipulate and group layers inside an MXD.

Theoretically, you can add the "Iterate Workspaces" module, and set it to work non-recursively on your parent folder.

Brooks_SummitGeo_0-1630483920267.png

Then you could iterate through the layers and merge them into one dataset, but then you'd have other challenges that I'm guessing you don't want to deal with. And would rather you just had a merge layer file containing the layers from you old 11 layer files?

If so, Python is your ticket out of this one.


David
..Maps with no limits..
0 Kudos
JohnnyJohansson
New Contributor III

Yes you'r right, merging layer would loose their symbology and is not the solution I'm loocking for.

I suspected that scripting is the solution... 😞

It would probably be less time consuming for me to add all layers in ffolder

to TOC, Group them, Rename by Foldername manually and save the Group as an new LYR file then to learn python scripting..

0 Kudos