Ticket #79 (closed enhancement: fixed)

Opened 4 years ago

Last modified 15 months ago

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: External ID:
state: Analysis Requested Browser: All
Operating System: All

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

Changed 3 years ago by pagameba

  • state changed from New to Analysis Requested
  • severity changed from Major to Minor
  • milestone changed from 1.1 to 2.0

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.

Changed 3 years ago by pdeschamps

  • owner changed from madair to pdeschamps

I'll take on this one.

Changed 3 years ago by pdeschamps

  • status changed from new to closed
  • resolution set to fixed

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

Changed 3 years ago by pdeschamps

  • status changed from closed to reopened
  • resolution fixed deleted

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

Changed 2 years ago by madair

  • milestone changed from 2.0 to Future

Changed 15 months ago by madair

  • status changed from reopened to closed
  • resolution set to fixed
  • milestone changed from Future to 2.3

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

Changed 15 months ago by madair

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

Note: See TracTickets for help on using tickets.