[fusion-dev] multilevel legend tree with mapserver

Paul Spencer pspencer at dmsolutions.ca
Fri Nov 14 06:58:25 EST 2008


Hi,

this is a moderated list so you need to be registered to post - I've  
let your posts through but please consider joining the list, it looks  
like you have some good stuff to contribute!

I would like to get some feedback from some other mapserver fusion  
users on this approach.  I would personally have attempted a metadata- 
based approach to keep all the configuration in the map file.  What do  
others think?

Regardless, multi-level grouping would be nice to support for  
mapserver in some fashion since the client-side already handles it for  
MapGuide.

Cheers

Paul

On 14-Nov-08, at 4:11 AM, klementszabolcs wrote:

> Hi i make multilevel tree in Mapserver/php/LoadMap.php.
> when make a mapfile.grp in the same directory where mapfile.map  
> exists,
> then the "groups":[] piece in loadmap json result change with the  
> grp file content.
> the grp file sample:
> "groups":[
> {   "groupName 
> ":"main 
> ","legendLabel 
> ":"xxx 
> ","uniqueId 
> ":"main 
> ","displayInLegend 
> ":true 
> ,"expandInLegend 
> ":false 
> ,"layerGroupType 
> ":"","parentUniqueId 
> ":"","parent":"","visible":true,"actuallyVisible":0
> },
> {
> "groupName 
> ":"sample 
> ","legendLabel 
> ":"sample 
> ","uniqueId 
> ":"sample 
> ","displayInLegend 
> ":true 
> ,"expandInLegend 
> ":false 
> ,"layerGroupType 
> ":"","parentUniqueId 
> ":"main","parent":"","visible":true,"actuallyVisible":0
> }]
>
> the change in loadmap.php:
> from line 280:
>
> $mapObj->groups = array();
>   $aGroups = $oMap->getAllGroupNames();
>     //multilevel tree
>   $groupfile=substr($_REQUEST['mapfile'], 0,  
> strpos($_REQUEST['mapfile'], ".")).'.grp';
>   if (file_exists($groupfile)) {
>     $groupstr=file_get_contents($groupfile);
>   }else{
>     foreach($aGroups as $groupName) {
>         $aLayerIndexes = $oMap->getLayersIndexByGroup($groupName);
>         if (count($aLayerIndexes) > 0) {
>             array_push($mapObj->groups, getGroupObject($oMap- 
> >getLayer($aLayerIndexes[0])));
>         }
>     }
>   }
>   //tree end
>   $retstr=var2json($mapObj);
>   if (isset($groupstr)) {
>     $retstr=str_replace('"groups":[]',$groupstr,$retstr);
>     //echo $groupstr;
>   }
>     echo $retstr;
>
>
>
>
>
> _______________________________________________
> fusion-dev mailing list
> fusion-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/fusion-dev


__________________________________________

    Paul Spencer
    Chief Technology Officer
    DM Solutions Group Inc
    http://research.dmsolutions.ca/



More information about the fusion-dev mailing list