How to Append symbol classes from two layers into one layer

290
9
Jump to solution
12-22-2020 03:57 AM
Labels (1)
ahmed_hussiney
New Contributor III

I have two layers in same MXD, Both are reading from the same data source but each of them had different symbol classes based on same field.

Now I want to append both layers symbol classes into one layer , so for example if layer1 has 3 classes and layer2 has 5 classes, I want to have only one layer with 8 classes.

I tried import symbols tool but it will do override symbol classes not append.

If any one had a solution either in ArcMap or ArcGIS Pro (I already imported the MXD to ArcGIS pro project) please share.

Thanks.. 

0 Kudos
1 Solution

Accepted Solutions
ahmed_hussiney
New Contributor III

I was able to test the ArcPy method in a sample map and it worked successfully but some time it was just copying classes without symbol and some time it was working as expected (I had add some code to update symbol colors in this case).


Here is the code for anyone who may face the same case:

ahmedhussiney1_0-1608810977803.png

However, when tried on my MXD after importing to ArcGIS Pro project it didn't work, I did many trials to understand the issue, one of the trials was to create new layer from same data source apply symbology using same fields, and keep default symbol classes (auto defined) then delete part of the symbol group and then redo the same for another new layer while keeping the other part of the symbol group and then try the script it works successfully.

The only difference I can see is that in the new layer I can go to layer symbology press add missing value and then choose the add new value option, it work in the new layers while when I try the same steps on original layer I got the error message "Requested operation could not be completed" with no further details I believe if I can fix this issue then the script will work.

 

View solution in original post

0 Kudos
9 Replies
DavidPike
MVP Regular Contributor

I don't think this is possible.  However you could save the symbol to a custom style, which is then easily selected when adding the extra classes. Modifying and saving symbols—Help | ArcGIS for Desktop

0 Kudos
ahmed_hussiney
New Contributor III

Thanks David,

The idea is that I want to have the classes and symbols copied, Otherwise I will manually do this which will be exhausting as I have many layers with too many classes.

If is possible to copy classes with symbols or only classes then assign symbol manually (after saving to style) this will help to reduce the effort.

0 Kudos
DavidPike
MVP Regular Contributor

Can you send a screenshot(s) of your current symbols/classes for a few layers for me to properly understand this? 

0 Kudos
ahmed_hussiney
New Contributor III

Hi David,

The following is a sample screenshot, I had two input layers landuse_1 , landuse_2 both of them is classified using "MPLU" field, but each layer is only concerned of set of sub-classes of the MPLU , As in the screen the layer landuse_1 has only 6 classes while landuse_2 had only 4 classes, I want to load all the 10 classes into one land use layer.

I should keep the same symbol and same classes, This is only a simple show case to clarify the issue.

ahmedhussiney1_0-1608642306259.png

 

0 Kudos
DavidPike
MVP Regular Contributor

Oh that should be fine, just needs a small amount of work to build a base layer .lyr file.  You'll need to select the layer with the most classes (only because it means less work) and build-up the classes in that one layer (even if they don't exist in that layer).

 

e.g. you would go to the symbology tab, and 'add value' and type in 'Residential' and then specify the symbol/colour for it.  When you've built the entire set of values, just right-click from the table-of-contents and save as a layer file.  You can import the symbology from the layer, but having a layer file saved is a useful backup if the mxd gets corrupted/lost/deleted etc.

 

0 Kudos
ahmed_hussiney
New Contributor III

Thanks David,

This solution is manual and I had to build missing symbol classes one by one and as I mentioned the screenshot is just for a simple show case it is not the real case I am facing which had too many symbol classes more than 50 classes for each layer with complex symbols (not just colors) , So I was looking if there is any geoprocessing tool or python code that can Import all symbols classes from first layer and append to second layer classes.

 

0 Kudos
DavidPike
MVP Regular Contributor

I think ArcMap won't cut the mustard on this one, the UniqueValues Class just doesn't seem to have the required properties, and most are read-only.

A quick look at the Pro documentation seems much more promising - UniqueValueRenderer—ArcGIS Pro | Documentation

I'd bet it could be done via arcpy with Pro.

0 Kudos
ahmed_hussiney
New Contributor III

Thanks David,

Yes arcpy with Pro looks promising I will give it a try.

 

0 Kudos
ahmed_hussiney
New Contributor III

I was able to test the ArcPy method in a sample map and it worked successfully but some time it was just copying classes without symbol and some time it was working as expected (I had add some code to update symbol colors in this case).


Here is the code for anyone who may face the same case:

ahmedhussiney1_0-1608810977803.png

However, when tried on my MXD after importing to ArcGIS Pro project it didn't work, I did many trials to understand the issue, one of the trials was to create new layer from same data source apply symbology using same fields, and keep default symbol classes (auto defined) then delete part of the symbol group and then redo the same for another new layer while keeping the other part of the symbol group and then try the script it works successfully.

The only difference I can see is that in the new layer I can go to layer symbology press add missing value and then choose the add new value option, it work in the new layers while when I try the same steps on original layer I got the error message "Requested operation could not be completed" with no further details I believe if I can fix this issue then the script will work.

 

View solution in original post

0 Kudos