Default catgory in Symbology

Sep 18, 2012 at 12:11 PM

I have a layer with about 20 categories. I want colorize 2 of them and rest of categories leave with some default color;

My code:


PolygonSymbolizer default = new PolygonSymbolizer(Color.LightGray); 
default.OutlineSymbolizer = new LineSymbolizer(Color.Gray, 1); 
default.LegendText = "default";
layer.Symbolizer = default; 

PolygonScheme scheme = new PolygonScheme(); 
PolygonCategory category1 = new PolygonCategory(Color.LightBlue, Color.DarkBlue, 1); 
category1.FilterExpression = "[field] = 'value1'"; 
category1.LegendText = "wood"; 
PolygonCategory category2 = new PolygonCategory(Color.Pink, Color.DarkRed, 1); 
category2.FilterExpression = "[field] = 'value2'"; 
category2.LegendText = "scrub"; 
layer.ShowLabels = true;
layer.Symbology = scheme; 

But in the Legend I cant see my default category, instead, I see some unexpected category with default color. If I comment ClearCategory() call so this layer disappears.

So my question - how to set up default category for my rest 18 categories.

Sep 19, 2012 at 12:18 PM

I wish I could help you, coloring layers with filters is one of my next, big step.....  perhaps you could show us more code, complete parts so i can use them and puzzle together how to solve things....

what i want is to define some classes for a layer -embedded in my software- with a colorscheme , for example   coloring buiding on their height in steps of 3meter


gr Joska

Oct 11, 2012 at 2:58 PM