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

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


Rob...

>...your code seems alot more efficient than mine

Thanks!

> All that aside though, did you manage to get some sort 
> of symbol displaying in your legend for raster data? 

No. This is a little annoying... especially from the standpoint of trying to
use HTML legends (i.e. a legend template). On the one hand, I understand
that having an icon for a raster layer is somewhat difficult (i.e... what
would you use for an aerial photograph?)... there are still circumstances
where you would want SOMETHING (a classified raster, for instance). For the
time being I just bagged on it, since my main goal was to create a set of
layer controls that also have some legend functionality.

>... could be substituted in using IFs and ELSES when the layer 
> name matches, but that obviously takes away from the mapfile-
> driven automation. Your thoughts would be appreciated.

Perhaps a combination would work. I think of raster data as being split into
two groups:
  - continuous data / imagery - aerial and satellite photography, scanned
base maps
  - classified data - land cover, elevation data, etc.

For 'continuous data'... I'm not sure you NEED an icon. I mean, for BW
photography... color doesn't necessarily have any meaning w/ resp to a
legend.

For classified data... I think you could still use mapscript to loop through
the classes on the object and pull out the color object to make an icon.
Haven't tried this... but I don't see why it would not work.

Thanks

Rob

-----Original Message-----
From: Hankley, Chip [mailto:Chip.Hankley at GASAI.Com]
Sent: Thursday, 12 September 2002 6:47 AM
To: MapServer List (E-mail)
Subject: [mapserver-users] TIP: Dynamic Legend (I did it!)


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


************************************************************************
The information in this e-mail together with any attachments is
intended only for the person or entity to which it is addressed
and may contain confidential and/or privileged material.

Any form of review, disclosure, modification, distribution
and/or publication of this e-mail message is prohibited.  

If you have received this message in error, you are asked to
inform the sender as quickly as possible and delete this message
and any copies of this message from your computer and/or your
computer system network.  
************************************************************************



More information about the mapserver-users mailing list