Opened 16 years ago

Closed 14 years ago

Last modified 14 years ago

#79 closed enhancement (fixed)

Allowing for Nested Groups in Legend when Using MapServer

Reported by: schneiderei Owned by: pdeschamps
Priority: P2 Milestone: 2.3
Component: MapServer Version: 1.0.6
Severity: Minor Keywords:
Cc: Browser: All
External ID: Operating System: All
state: Analysis Requested

Description

MapServer seems to restrict organising layers to two levels: One can have regular map layers right at the top-most level, or one can specify groups and assign the layers to them. Assigning groups to groups, that is, specifying nested groups in a tree is not supported. This limitation is reflected in the file MapServer/php/LoadMap.php where a line of comment mentiones this limitation.

I have played with that piece of code a bit, and it seems that the limitation can easily be overcome. In the function getGroupObject(..), the layer that is passed to the function can be queried for its parent. If the layer corresponds to the group, it will know about it parent group, and this information can be stored in group->parent as well as in group->parentUniqueId.

(I think that there is a bug where the function is called, a few lines above, because the layer that is passed to the function may or may not be the group layer in question. The function queries for group information such as METADATA "groupLegendLabel" which returns empty results if the layer is not the group layer of interest. I'll post a separate ticket on this.)

After having changed the code in this way, the groups are indeed nested in the legend, they behave as they should when checked and unchecked, and the maps are drawn correctly accounting for the visibility status of the groups and layers.

Change History (7)

comment:1 by pagameba, 16 years ago

Milestone: 1.12.0
Severity: MajorMinor
state: NewAnalysis Requested

The legend widget certainly supports nesting groups within groups, but the problem I perceive is that MapServer itself has no mechanism to nest groups. Layers can either belong to a group or not, but there is no way of doing this for groups.

It is straight-forward to implement using some form of metadata in the map file, as long as we establish and document a convention for this and put support for it in LoadMap.php (support linking groups to parent groups).

I would suggest that we support reading a "groupParent" metadata that can hold the name of a group for nesting in the legend.

comment:2 by pdeschamps, 16 years ago

Owner: changed from madair to pdeschamps

I'll take on this one.

comment:3 by pdeschamps, 16 years ago

Resolution: fixed
Status: newclosed

added login in the scale processing to reset the layers min / max scales to be set to the main map's min man scales if they happen to exceede the main map scales. without this you get un expected ui behaviour in the legend.

/fusion/trunk/layers/MapServer/php/LoadMap.php REV # 1776

I added closes comment in the commit however it did not close the bug

comment:4 by pdeschamps, 16 years ago

Resolution: fixed
Status: closedreopened

reopening, This is the wrong ticket. This is my next item todo: disregard last message

comment:5 by madair, 15 years ago

Milestone: 2.0Future

comment:6 by madair, 14 years ago

Milestone: Future2.3
Resolution: fixed
Status: reopenedclosed

implemented at [2284], allows for one level of nesting using a 'parentGroup' metadata element.

comment:7 by madair, 14 years ago

the client requirement was for mor than one level of nesting so rev [2285] implements this

Note: See TracTickets for help on using tickets.