2

I'm trying to figure out how to apply graduated color symbology to a feature class by using arcpy.mapping in ArcMap 10.1.

To start, a script runs and a feature class is added to a map document, no problem. This feature class needs the graduated colors. The value field used for the graduated colors is created during the script.

In order to apply the graduated colors, I have to create a layer file from the feature class. This is where I start to get confused. I know UpdateLayer has to be used, and I have to base the update on a source layer? I tried this with no luck.

If someone can just guide me on what order the steps are to apply a graduated color symbology to a feature class using arcpy.mapping, it will be appreciated. I should be able to figure out the rest of the scripting. Thanks!

1 Answer 1

2

I haven't tried this personally, but it looks like you need to access the GraduatedColorsSymbology class on the layer. Have a look at the second example at the bottom of this page.

It also looks like you may need to have an existing lyr file with the graduated colours already set in order to use UpdateLayer.

3
  • @dubch87 I agree - through ArcPy you can only change the field used by an existing GraduatedColorsSymbology not assign one to a layer symbolised another way.
    – PolyGeo
    Apr 24, 2013 at 9:56
  • 1
    arcpy.ApplySymbologyFromLayer_management worked for me. I was then able to use UpdateLayer with the correct break values and labels.
    – dubch87
    Apr 25, 2013 at 21:35
  • @dubch87 Can you give me an example of the python you'd use for this? I have a query layer tied to a SQL Database and I need the Break Values for the layer to adjust as the data in the database(and query layer) is changed.
    – Tim
    Aug 12, 2014 at 22:51

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.