Dynamically apply symbology to layer

1701
2
06-06-2011 03:51 PM
KalongiDrake
New Contributor
I have a script that updates the source of a layer with a feature set that is passed in as a parameter. I want to define the symbology for the layer using graduated colors. I don't see a way to do this programmatically in the script, as it doesn't appear that arcpy provides a means to update layer symbology programmatically, and using UpdateLayer doesn't get me what I need, because I'd have to define the class breaks based on an existing dataset, but I need the class breaks to be adjusted according to the updated source data for the layer . Does anyone know of any creative way to make this happen?
Tags (2)
0 Kudos
2 Replies
KimOllivier
Occasional Contributor III
Its the KISS principle. If all the functions were added that could be done from ArcObjects, then it would be ArcObjects. So the official view would be to use ArcObjects.

You may be able to approximate different class breaks by saving the range of breaks you anticipate to be needed, do some statistics and call in the required layer template.

If only we had access to an ascii dump of layer objects (as an XML file) we could hack a symbol definition in a layer just like we could with Avenue. Meanwhile it is possible to call ArcObjects from Python using the ctypes module and a good manual on ArcObjects.
0 Kudos
KalongiDrake
New Contributor
Rather than call arcobjects from python, I decided to create a .net web service to connect to ags server directly and invoke arcobjects there. Hopefully in future versions of arcpy symbol renderers will be exposed. It seems reasonable to me that, if I can update the data source of a layer in arcpy, I would be able to modify the properties of the layer's renderer to reflect those changes.
0 Kudos