Hi All,
I have been looking for about 2 days and I can't seem to figure out or find a work around for the symbology labels after a reclassify when trying to automate maps. I run the following code and it is almost doing exactly what i want it to do. After I change a data source path I run the following 2 lines of code. The layer is set to have the colors i want and the numbers match what should be there. The only issue is the display of the labels for the classification.
arcpy.mapping.UpdateLayer(df, lyr, updateLayer, True)
lyr.symbology.reclassify()
The map is set to have 1 decimal place as is the layer file but after the reclass is set to 4 significant digits.
Does anyone have any thoughts? This is the one thing i need to fully automate the maps i am working on. It seems crazy that after doing a change path and a reclass that i have to open the mxd reset the layer properties and then update notes that i have generated based on the new classes with the update ranges.
Thanks Matt
Solved! Go to Solution.
i figured out my own solution by building my ranges my self from the classBreakValues
lower_range1 = "{:.1f}".format(lyr.symbology.classBreakValues[0]) + " - " + "{:.1f}".format(lyr.symbology.classBreakValues[1])
lower_range2 = "{:.1f}".format(lyr.symbology.classBreakValues[1] + .1) + " - " + "{:.1f}".format(lyr.symbology.classBreakValues[2])
lower_range3 = "{:.1f}".format(lyr.symbology.classBreakValues[2] + .1) + " - " + "{:.1f}".format(lyr.symbology.classBreakValues[3])
lower_range4 = "{:.1f}".format(lyr.symbology.classBreakValues[3] + .1) + " - " + "{:.1f}".format(lyr.symbology.classBreakValues[4])
output
15.4 - 24.6
24.7 - 28.5
28.6 - 34.6
34.7 - 60.3
I still say it would be much easier if these were settings of GRADUATED_COLORS symbology.
Thanks all,
Matt
It's not explicitly stated, but possibly you can use the classBreakDescriptions property to enforce this. You might have to get the descriptions, read and modify them into a new list, then add that back.
Never used this myself, so take the idea for what it's worth.
Hi Keith,
I looked into this before but all it seems to do is allow me to add more text to the range.
Ex.
1.25-2.45 - without description
1.25-2.45 test - with description added.
Thanks for the thought!
Matt
I have not tried this personally in python script but give it a try and see if this works...
Hi,
As stated above it seems to only allow you to add text to the ranges.
Thanks,
Matt
i figured out my own solution by building my ranges my self from the classBreakValues
lower_range1 = "{:.1f}".format(lyr.symbology.classBreakValues[0]) + " - " + "{:.1f}".format(lyr.symbology.classBreakValues[1])
lower_range2 = "{:.1f}".format(lyr.symbology.classBreakValues[1] + .1) + " - " + "{:.1f}".format(lyr.symbology.classBreakValues[2])
lower_range3 = "{:.1f}".format(lyr.symbology.classBreakValues[2] + .1) + " - " + "{:.1f}".format(lyr.symbology.classBreakValues[3])
lower_range4 = "{:.1f}".format(lyr.symbology.classBreakValues[3] + .1) + " - " + "{:.1f}".format(lyr.symbology.classBreakValues[4])
output
15.4 - 24.6
24.7 - 28.5
28.6 - 34.6
34.7 - 60.3
I still say it would be much easier if these were settings of GRADUATED_COLORS symbology.
Thanks all,
Matt