read out symbology/class breaks in .lyr file

1962
4
12-11-2011 04:06 AM
JohnMorgan
Occasional Contributor
Hello,
I have a .lyr file and would like loop through symbology/class breaks (?).  What I mean is the part that defince show this color from values x-y etc... so that I can read them out into a report or file.  I was able to do this in vba in 9.3 But, I am trying to do the same in version 10 with python and can't seem to figure it out as I am new to python and arcobjects.  If anyone has any words of advice on how to do this it would be greatly appreciated.  Here is what I have so far:


import arcpy
mxd = arcpy.mapping.MapDocument("C:\Data\PhD\Teaching\ArcGISProgrammingWithPython\jdm.mxd")
for lyr in arcpy.mapping.ListLayers(mxd):
    x = lyr.name


Thanks,
Derek
Tags (2)
0 Kudos
4 Replies
JohnMorgan
Occasional Contributor
I think I may have found the answer to my own question in the ESRI ArcGIS Help Library where it says "not all layer properties are accessible through the Layer object. There are many properties available in the ArcMap Layer Properties dialog box that are not exposed to the arcpy scripting environment (e.g., scale ranges, display properties, field aliases, symbology, and so on) ()." 

I am guessing this means that if I want to perform this type of scripting I should consider .Net ArcObjects instead.  Anyones feedback on this is appreciated if I am not on the wrong track.  I am new to these technologies.

Thanks,
Derek
0 Kudos
JeffBarrette
Esri Regular Contributor
This can't be done with Python at 10.0.  At 10.1 the arcpy.mapping API has been expanded to includes some renderers (e.g., Graduated Colors, Raster Classified, etc).  This will be possible for those renderers.  For example,

mxd = arcpy.mapping.MapDocument("current")
lyr = arcpy.mapping.ListLayers(mxd, "MyRasterLyr")
if lyr.symbologyType == "RASTER_CLASSIFIED":
  print lyr.symbology.classBreakValues
  print lyr.symbology.classBreakLabels
0 Kudos
yosukekimura
New Contributor III
Jeffrey,

Thank you for info for new version, that seems to what I am looking for right now (i am not OP).  Do you know if it has writ support, meaning that I can provide break values and labels to use from script?  Also, do you know when it will be available?

Thanks,
0 Kudos
JeffBarrette
Esri Regular Contributor
These properties are read/write.  10.1 is available now in beta.  10.1 final is scheduled to be available sometime in Q2.

Jeff
0 Kudos