More issues with updating symbology outline with arcpy

3133
1
10-10-2014 01:38 PM
JustinGrana
New Contributor

This is mostly in reference to bug NIM085601 and is also the main issue in this post and this, although there are still unanswered questions as of august 6th.

 

The issue is simple, I have a layer in a map document (main_layer) and a (source_layer).  I want to apply the symbology from source_layer to main_layer and then change the classBreakValues attribute.  My python script is simple

 

...

 

source_layer = arcpy.mapping.Layer(symbology_layer)

break_values = [1., 2., 3. ,4.]

arcpy.mapping.ListLayers(mxd)[0].symbology.classBreakValues = break_values

arcpy.mapping.UpdateLayer(df, arcpy.mapping.ListLayers(mxd)[0], source_layer, True)

 

 

However, in the source layer, the outline has width 0 but **only when I change the break values**, the width reverts back to default.

 

I have updated to Arc 10.2 and this is still occurring.

 

Also, the reason that I change the break values before calling the UpdateLayer function is because when I do it after, I get:

 

  File "C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\arcobjects\_base.py", line 89, in _set

    return setattr(self._arc_object, attr_name, cval(val))

RuntimeError

 

which I think is also related to this (unanswered) question.

 

Thanks to anyone that might be able to help.  I would be happy to share mapdocuments and code for replication.   

Tags (1)
0 Kudos
1 Reply
JustinGrana
New Contributor

Thinking about this a bit more, it might be that there is no trivial solution to this problem.  For example, suppose that in the source layer, different classes had different outline properties.  Then, if I want to change the number of breaks after applying the symbology, Arc wouldn't (and appropriately shouldn't) know which outlines to apply to which classes, and therefore it relies on the default parameters. 

The only potential fixes I see would both be new features.  The first would simply be to have a more fine grained control of symbology patterns within arcpy and then be able to set each parameter separately (which after perusing many blogs and message boards seems to be requested by many).

The second option would be to change the default symbology field.  Therefore, if we wanted to apply a characteristic to **all** fields (i.e. now outline) we would just be able to set the default.

0 Kudos