WebLegend Parent Node problem

Dec 6, 2012 at 2:36 PM


Im using DotSpatial.Examples.DemoWEB and i try to encapsulate layers in themes, for example:


+ layer 1.A

+ layer 1.B


+ layer 2.A

+ layer 2.B

I cant create an LegenItem object with LegendSymbolMode = Group.

Can anybody help me? thanks in advance


Dec 9, 2012 at 6:50 AM

I didn't work with web demo, but for grouping you should create new MapGroup then add layers to this group.

Dec 10, 2012 at 4:06 PM

hi Mese79

MapGroup seems dont works with WebMap. WebMap only supports AddLayer method.

WebMap.AddLayer(string fileName)

fileName is a physical path to the layer file.

Another idea?



Dec 11, 2012 at 7:35 AM
Edited Dec 11, 2012 at 7:36 AM

Yep! you are right.

So i think you should create your own legend control based on treeview and fill it like what you want.

For Example you could create a group object in javascript like:


var group = {
  id: 1,
  legendText: "group 1",
  layers: ["layer1", "layer2"]

Then use it to populate your treeview.


Dec 12, 2012 at 9:43 AM

Hi mese79

I try it updating WebLegend Render method but when i insert an item as parent node, the layers crash and not shown when i check its.

I wait for a new release :(



Jan 7, 2013 at 2:58 PM

At present I have not time to working on this issue but I think will not very difficult to modify th legend populator (is a simple recoursive function...)

(all italian in ths discussion ?)