[fusion-users] More than two hierarchy levels in the legend (with MapServer)

Bernhard Schneider bernhard.schneider at ilu.ch
Mon Jun 9 03:11:55 EDT 2008


Hello everyone,

For the map application I am currently working on, it would great if I  
could freely nest map groups in the legend. It seems to me, however,  
that Fusion, when using MapServer as map rendering engine, only allows  
two levels of hierarchy, that is, map groups can only contain regular  
map layer, not other map groups.

Because this bothered me, I checked the code, and I think that the  
function parseMapLayersAndGroups() of Fusion.Maps.MapServer is  
responsible for this limitation. This function receives the layer and  
group information in two lists, one containing all map layers  
(including the map groups), and one containing only the map groups.  
Interestingly, the hierarchy information is only given in the layer  
list where each layer knows which layer its parent is. The map groups  
list holds the necessary data structures, but the according fields are  
empty.

In a bold attempt to overcome the limitation, I altered the function  
by adding code (which I am happy to share) that loops through the  
group list. It checks for each group if there is a parent indicated  
for the corresponding map layer (as mentioned, each group also exists  
as layer in the layer list). If so, the parent information is assigned  
to the group so that each group knows whether it belongs to another  
group. I'm not sure whether I made things better or worse, but the fix  
works in my application.

Any thoughts or comments?

Bernhard



More information about the fusion-users mailing list