[mapserver-users] TIP: Dynamic Legend (I did it!)

Hankley, Chip Chip.Hankley at GASAI.Com
Thu Sep 12 09:55:31 EDT 2002


Paul...

You're right, it's not in the code I posted... I thought it made the example
too complex, but, maybe I should add it in.

The way I've handled this in the past was to do a check on SCALE vs MAXSCALE
and MINSCALE. If the layer won't be displayed (i.e. SCALE > MAXSCALE OR
SCALE < MINSCALE), then I

1) echoed 'disabled' in the checkbox's HTML definition
2) showed that line of the legend in a different color... I prefer gray.

This way, the user still sees that it's there... but it just is unavailable.

If this doesn't make sense, let me know... and I'll send you some code.

Chip Hankley

-----Original Message-----
From: Paul Spencer [mailto:spencer at dmsolutions.ca]
Sent: Wednesday, September 11, 2002 5:52 PM
To: Hankley, Chip
Cc: MapServer List (E-mail)
Subject: Re: [mapserver-users] TIP: Dynamic Legend (I did it!)


Chip, have you thought about what happens when layers turn on and off 
due to scales of visibility?  A pretty common problem we are seeing is 
that people set certain layers to appear as the user zooms in, but if 
the layer doesn't appear in the $_POST data then it is turned off.  I 
don't think that the code you wrote handles this case.  If you come up 
with an easy solution to this, please let me know and I'll put it in the 
next release of MapLab :)

Cheers,

Paul

Hankley, Chip wrote:
> OK... I figured out how to do this... and put the code in the Wiki at the
> following location:
> 
> http://mapserver.gis.umn.edu/cgi-bin/wiki.pl?PHPDynLegend
> 
> (There is a link under the Examples section of PHP MapScript)
> 
> Basically what it does is reads a mapfile, and creates a legend / layer
> control on the fly. Furthermore, it sets up the controls so that state is
> maintained with only a couple of lines of code... and any changes to the
> mapfile (i.e. additional layers, changes to layers) are automatically
> reflected in the application (i.e. there's no need to make changes to the
> PHP part of the application).
> 
> Hope this is useful to someone!
> 
> Chip Hankley
> 


-- 
Paul Spencer
Applications and Software Development
DM Solutions Group



More information about the mapserver-users mailing list