I have this lyr file which have a data source I don't know where is. When I set a new data source, it's the lyr file with all the symbology that gets replaced with the default values from the data source, no the other way around.

Is there any way to get the coloring codes (which has to point to values in a table from the data source) in the lyr file?


Simplest approach would be to create another feature class with same field name of original feature class and apply the symbology to this new feature class.

If you don't know the field name, then you have to go Python (Arcpy)

From your snapshot it seems it is a "unique values" symbology which fortunate is exposed to arcpy.

Here is a snippet to print your symbology information:

import arcpy
mxd = arcpy.mapping.MapDocument("current")
lyr = arcpy.mapping.ListLayers(mxd, "layerName")[0]
if lyr.symbologyType == "UNIQUE_VALUES":
  print lyr.symbology.valueField
  print lyr.symbology.classDescriptions
  print lyr.symbology.showOtherValues
del mxd

you can copy & paste this code in ArcMap Python window

  • That is the problem, I don't know anything about the original feature class. – DOMINUS MIHI ADIUTOR Nov 17 '15 at 10:17
  • @2013US10 see the update answer – Farid Cheraghi Nov 17 '15 at 14:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.