[fusion-users] Proper Class Names in MapServer Mapfile

Paul Spencer pspencer at dmsolutions.ca
Tue Sep 8 16:48:00 EDT 2009


Tim, do you know in which mapserver version $class->title got added to  
mapscript?  What will happen in older mapserver installs, will it  
return an empty string?

Paul

On 2009-09-08, at 4:45 PM, Nolte, Tim wrote:

> OK, so I decided to do a little digging in the MapServer code. I'd  
> like
> to propose the following code change in the LoadMap.php:
>
>         //create classes and slot them into the scale breaks
>         for ($j=0; $j<$layer->numclasses; $j++) {
>             $oClass = $layer->getClass($j);
>             $classObj = NULL;
>             // Use formatted legend label as defined by CLASS->TITLE
>             $classObj->legendLabel = $oClass->title != '' ?
> $oClass->title : $oClass->name;
>             //$classObj->legendLabel = $oClass->name;
>             $classObj->filter = $oClass->getExpression();
>             $classMin = $oClass->minscale == -1 ? $layerMin :
> max($oClass->minscale, $layerMin);
>             $classMax = $oClass->maxscale == -1 ? $layerMax :
> min($oClass->maxscale, $layerMax);
>             $classObj->minScale = $classMin;
>             $classObj->maxScale = $classMax;
>             $classObj->index = $j;
>             for ($k=0; $k<count($aScaleRanges); $k++) {
>                 if ($classMin < $aScaleRanges[$k]->maxScale &&
>                     $classMax > $aScaleRanges[$k]->minScale) {
>                     array_push($aScaleRanges[$k]->styles, $classObj);
>                 }
>             }
>         }
>
> This block starts around line 306. My code change looks for a
> CLASS->TITLE and uses that and if not found falls back on the
> CLASS->NAME. I've tested and it works perfectly! I would really like  
> to
> not have to manually maintain my custom code here. Thanks!
>
> - Tim
>
> ----
> Timothy J Nolte - tnolte at ilpcs.com
> Network Planning Engineer
>
> iPCS Wireless, Inc.
> 4717 Broadmoor Ave, Suite G
> Kentwood, MI 49512
>
> Office: 616-656-5163
> PCS:    616-706-2438
> Fax:    616-554-6484
> Web: www.ipcswirelessinc.com
> -----Original Message-----
> From: fusion-users-bounces at lists.osgeo.org
> [mailto:fusion-users-bounces at lists.osgeo.org] On Behalf Of Nolte, Tim
> Sent: Tuesday, September 08, 2009 4:14 PM
> To: fusion-users at lists.osgeo.org
> Subject: [fusion-users] Proper Class Names in MapServer Mapfile
>
> I have figured out how to give properly formatted names to groups and
> layers. The problem I run into now is I have a few layers that I am
> classifying. These classified layers are showing the crude CLASS ->  
> NAME
> (e.g. 'on_air_evdo') but I want to have Fusion show a properly  
> formatted
> name (e.g. 'EVDO On-Air'). Thanks.
>
> - Tim
>
> ----
> Timothy J Nolte - tnolte at ilpcs.com
> Network Planning Engineer
>
> iPCS Wireless, Inc.
> 4717 Broadmoor Ave, Suite G
> Kentwood, MI 49512
>
> Office: 616-656-5163
> PCS:    616-706-2438
> Fax:    616-554-6484
> Web: www.ipcswirelessinc.com
> _______________________________________________
> fusion-users mailing list
> fusion-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/fusion-users
>
> _______________________________________________
> fusion-users mailing list
> fusion-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/fusion-users


__________________________________________

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



More information about the fusion-users mailing list