Opened 16 years ago
Last modified 15 years ago
#77 new enhancement
Function "getGroupObject(..)" in MapServer/php/LoadMap.php not quering group information correctly
Reported by: | schneiderei | Owned by: | madair |
---|---|---|---|
Priority: | P2 | Milestone: | Future |
Component: | MapServer | Version: | 1.0.6 |
Severity: | Critical | Keywords: | |
Cc: | Browser: | All | |
External ID: | Operating System: | All | |
state: | Analysing |
Description
Line 262 in the file MapServer/php/LoadMap.php reads:
array_push($mapObj->groups, getGroupObject($oMap->getLayer($aLayerIndexes[0])));
The layer that is passed to getGroupObject(..) may or may not be a group layer. In the function getGroupObject(..), group information is queried from this layer through calls such as "$layer->getMetaData('groupLegendLabel')". It seems to me that group information is not returned if the layer is not a group layer. As a result, all metainformation specified for groups in the map file is ignored.
There are a number of solutions to this. One would be to just add a second parameter to the getGroupObject(..) function where the according group layer is passed. Line 262 then could look like this:
array_push($mapObj->groups, getGroupObject($oMap->getLayer($aLayerIndexes[0]), $oMap->getLayerByName($groupName)));
All metadata queries in getGroupObject(..) would then go to the group layer.
Change History (2)
comment:1 by , 16 years ago
Milestone: | 1.1 → 2.0 |
---|---|
state: | New → Analysing |
Type: | defect → enhancement |
The relevant code is:
First we get all the group names, then we get all the indexes of the layers that belong to each group, then we get the group information from the first layer in the group.
As far as I know, there is no such thing as a group layer. This seems to be your own convention - naming a layer by the group name. Perhaps I am wrong? But there certainly doesn't need to be a layer named the same as the group name.
I believe that the correct way to get group information is from the first layer in the group (as it appears in the map file). This could be inconvenient for managing map files and I wouldn't mind having this loop over all the layers and stopping at the first layer that has the groupLegendLabel metadata so that the metadata can be added to any layer in the group and it will still work, even if you move layers around in the drawing order.