I have to render a feature layer with a graduated colors renderer, using the ArcGIS API for Java (or VB, .NET).

As the feature layer data is created dynamically using webservices, I don't in advance the range of values, so I need to get the classification to be generated using the natural breaks algorithm.

Here is what I need to set:

Layer properties window

In addition, I need to get the largest values overlaying the smallest:

Symbol level dialog

I need to get n classes, using a AlgorithmicColorRamp from one given color to another color and symbolized by a simple line with a given width.

I tried to write this method, called after the layer data source is set:

    public static void applyGraduatedColorsLineRenderer(IGeoFeatureLayer geoFeatureLayer, String field, int count, IColor fromColor, IColor toColor, double width) throws UnknownHostException, IOException {
    IAlgorithmicColorRamp colorRamp = new AlgorithmicColorRamp();
    boolean[] ok = new boolean[1];

    ClassBreaksRenderer classBreaksRenderer = new ClassBreaksRenderer();

    for(int i = 0; i < count; i++) {
        SimpleLineSymbol simpleLineSymbol = new SimpleLineSymbol();
        classBreaksRenderer.setSymbol(i, simpleLineSymbol);


The problem is that I don't get the right range for my data, and the classification method is set to "manual" instead of "Natural Breaks": enter image description here

Moreover, I don't know what is the equivalent in ArcObjects of checking "Draw this layer using the symbol levels specified below".

  • Not sure if this applies but perhaps you could use a template layer and import the symbology that way like in THIS question. – landocalrissian Dec 15 '14 at 17:10
  • It doesn't work as the symbology depends on the feature class data. So I think it needs to be generated for each new data programmatically. – superrache Dec 16 '14 at 17:24

It's maybe too late for an answer, but I think thats what you needed - the


IClassify classifyMethod = new NaturalBreaksClass();
(classBreaksRenderer as IClassBreaksUIProperties).Method = classifyMethod.ClassID;

The checking "Draw this layer using the symbol levels specified below" you can also set with the UIProperties: IClassBreaksUIProperties.ShowClassGaps Property

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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