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

Hankley, Chip Chip.Hankley at GASAI.Com
Thu Sep 12 14:33:35 EDT 2002


Based on Antti's and Paul's comments, I made some changes to the script.

1) Script writes out legend content to a static file. It checks the date of
the mapfile and the static file. If the mapfile is newer, it replaces the
static file. Otherwise, the static file is just included();

2) Script responds appropriately to layers that are outside of the MAXSCALE
or MINSCALE bounds by:
  a) disabling the control
  b) turning the layer description 'gray' rather than black.

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