Select to view content in your preferred language

how to keep symbology outlines the same when I change the value field

6987
18
Jump to solution
12-03-2012 04:24 AM
TimothyMcNeel
Emerging Contributor
I'm using graduated colors symbology with quantiles, and I have different fill colors and outline colors for the different quantile categories.  My python script loops through several fields, and for each field it sets the layer's symbology.valueField to the new field and creates a JPEG using arcpy.mapping.ExportToJPEG.  The quantiles recalculate correctly based on the new field, and the fill colors for each quantile group remain correct, but the outlines all change to gray.  How can I keep outlines the same (or reset them after they change) when I change the value field?

I don't see any way to to set the outline colors directly using Python.  I tried setting up a layer with the correct symbology and applying that (using arcpy.mapping.UpdateLayer and, in a separate attempt, arcpy.ApplySymbologyFromLayer_management) to my main layer after switching the value field.  But it appears that these functions set the symbology value field in addition to the fill colors and outlines.

I'm using ArcGIS 10.1.
Tags (2)
0 Kudos
18 Replies
ShaneArmour
Deactivated User
I was able to make a map without borders. I am still having issues with the break values. Is there a way to keep updating the breakclasses and legend between ApplySymbologyFromLayer_management and the exporting process?

Thank you!
0 Kudos
TimothyMcNeel
Emerging Contributor
My script went immediately from arcpy.ApplySymbologyFromLayer_management to arcpy.mapping.ExportToJPEG with no intermediate steps.  Changing break values in between would probably cause the outlines to change.
0 Kudos
TravisLogan
New Contributor
Has this bug  (tracking number is NIM085601) actually been addressed in arc 10.2?   I'm still  having the same problem using either 'ApplySymbologyFromLayer_management', 'UpdateLayer', or  'classBreakvalues' .... my source .lyr is a polygon layer w/ graduated symbology and no outlines. When I apply its symbology to my 'update layer' I automatically get grey borders...


Thanks
Travis Logan


Unfortunately, that's a bug (the bug tracking number is NIM085601). We have a targeted fix of SP2 (tentative date spring 2013).

Workarounds could get tricky for this issue. You can try using arcpy.mapping.UpdateLayer with the symbology_only option set to True. You would have to have a staged .lyr file that contains the fields and symbology that you want. However, if the data is different, then the class breaks may not be what you expect - in which case you would call symbology.reclassify(). However, reclassify has the same bug in that it resets outline properties. In that case, you would NOT use reclassify() and instead determine the breaks and labels using some scripting logic and then apply those values to the renderer via .classBreakValues and .classBreakLabels.
0 Kudos
JeffBarrette
Esri Regular Contributor
Yes, this bug was addressed during a 10.1 SP.

I just retested the original use cases and the original bug is still fixed.  It is possible you have a slightly different scenario.  Please contact support services so we can isolate and fix the issue.

Jeff
0 Kudos
MattGray
Deactivated User
I know this is an old thread, but its 2014 now and I am experiencing this exact issue, even after having 10.1 and sp1.  Is this going to get corrected in 10.2?
0 Kudos
JeffBarrette
Esri Regular Contributor
Send me a very simple map package with data and a simplified script the reproduces the problem and I'll verify.  The original data / script that was used to reproduce the original issue was not longer reproducible when the bug was "fixed".

Send map package / script to jbarrette@esri.com

Jeff
0 Kudos
JeffBarrette
Esri Regular Contributor
I could reproduce the issue.  That for a nicely organized package and script.  The original reported bug was resetting the outlines on the graduated color (symbology).  This scenario is a little different because it uses graduated symbol (size) but each color is also graduated (its sort of a combination of graduated color and graduated symbol).

We are looking into providing a fix.
Jeff
0 Kudos
JeffBarrette
Esri Regular Contributor
A fix will be provided with ArcGIS 10.2.2.  If you are interested in tracking the issue, the tracking number is NIM098086.

Jeff
0 Kudos
ShaneArmour
Deactivated User

Hi Jeff,

I'm still experiencing this problem after installing 10.2.2. Can you provide any update?

Thanks,

Shane

0 Kudos