2

Does anyone know if it is possible to access the symbolgy levels in ArcGIS10 with python?

I have a layer "temp" that I print to a pdf. The symbology is printed correctly but is drawn in the wrong order (there are overlapping points with different colours). Outside python I can fix this problem by ticking the check box unter properties -> symbology -> Advanced -> Symbol Leves... -> "Draw this layer using the symbol levels specified below"

Can I check this box inside a python script?

3
  • I am almost positive I have read somewhere that this is not doable, but I cannot cite it. Maybe for others it could help to know which version of ArcGIS 10 you are using. Commented Feb 12, 2015 at 15:13
  • I am using ArcMap10.0. Thanks for your comment...Can someone confirm this? Commented Feb 12, 2015 at 15:31
  • 1
    There is not any fine grained control of advanced symbology in arcpy. As Jeff Barry from Esri put it, they are trying to draw a line in the sand between Arcpy and ArcObjects. You will have to use ArcObjects for advanced symbology. You can however, call ArcObjects from Python via comtypes but they do not always play nicely in Python.
    – crmackey
    Commented Feb 12, 2015 at 17:52

2 Answers 2

1

I don't know if this is equivalent, but I ran into a slightly similar issue where I needed to provide advanced symbology - including symbol levels - to a layer in a model referencing data on disk, and add this layer to TOC. With my first attempts, I could add only the basic symbology to the layer, but the symbol levels were dropped, making the layer totally unusable.

I solved this by saving the original layer with symbol levels to a *.lyr file, and then use the

Layer.replaceDataSource(X)

and

arcpy.mapping.AddLayer(X)

commands to first replace the datasource of the saved *.lyr by a reference to my "temp" layer, and then adding the lyr file to the TOC.

This helped me maintain all layer properties, including symbol levels, definition queries and labeling settings, while still being able to reference my "temp" layer.

1
1

This sort of fine grain control of symbology is not possible with ArcPy.mapping at this time. But until then, here's a work-around...

If you separate your symbology into different layers, using definition queries, you could then reorder your layers in Python, much the same way you'd be able to in the advanced symbology window within ArcMap.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.