Select to view content in your preferred language

Read layer symbology class color with ArcPy

2588
5
09-13-2013 04:12 AM
JohnMorgan
Regular Contributor
I am using ArcPy within ArcGIS 10.1 and attempting to read symbology from a *.lyr file created by a raster dataset within ArcMap. My goal is to be able read out the RGB (color) values assigned to the class breaks on the dataset. It???s seems easy enough to get the lyr file into an object with:

lyrFile = arcpy.mapping.Layer("C:/.../ReadLyrFileSymbology/conus_foresttype6.img.lyr")


However, after that I am unable to find the method or property to get symbology color (RGB) on a layer. Any pointers would be greatly appreciated.

Thanks,
Derek
Tags (2)
0 Kudos
5 Replies
MattSayler
Frequent Contributor
I don't think it's currently possible using python, unless someone has sorted out a way to parse out the lyr file directly. Applying an existing lyr file to a layer in the ToC is about the extent of what can be done to manipulate symbology using python in 10.1.

I think it's probably on the Esri radar though, as a lot of people want to be able to do those sorts of things. They seem to be expanding arcpy every release, so it's probably only a matter of time. That doesn't really help you NOW though.
0 Kudos
ZdenkaHofman
Emerging Contributor
I'm trying to do something similar as well.  I'd like to be able to use the RGB values and the associated to labels in a separate graphics software.  Even being able to print a list would be helpful.
0 Kudos
JasonScheirer
Esri Alum
Can't do it in arcpy.
0 Kudos
AgataZurek
Occasional Contributor

Any update on this?

Jason Scheirer, do you know if this will be made available?

Thanks!

0 Kudos
JasonScheirer
Esri Alum

This is beyond the scope of the initial arcpy.mapping design, so we don't intend on adding it

There will be a roundabout way of doing some color-level symbology manipulation in 10.3 via JSON layer definitions.

0 Kudos