How to create a legend containing ONLY classes shown in current map?

David Fawcett David.Fawcett at STATE.MN.US
Wed Nov 24 09:55:15 EST 2004


Ken,

So then based on your naming scheme, I assume that you use conditional
statements in your html legend template to determine which classes
should show?

(html legend info at
http://mapserver.gis.umn.edu/doc42/html-legend-howto.html)

David.


David J. Fawcett
MN Office of Environmental Assistance

>>> Ken Lord <kenlord at GMAIL.COM> 11/23/2004 5:30:36 PM >>>
MapServer CGI will not hide individual classes based on map scale in
the way that you are hoping to do.

The way I have attacked this is to place the scale range at which the
class is visible within the name of the class, so that the name of the
class and its viewable scale range is listed in the legend.

hypothetical example of names given to classes in a layer that
displays highways/roads/trails at different scales:

Highway < 1:50,000
Local Roads < 1:20,000
Trails < 1:5,000

Cheers,
Ken Lord
Vancouver BC


On Tue, 23 Nov 2004 11:08:24 -0600, Daniele Margotti
<margottid at comune.lugo.ra.it> wrote:
> Hi,
> I have another question about the legend...
>
> How can I tell CGI Mapserver to create a legend containing ONLY
classes
> that are visible in the current map?
>
> Now I get a legend that contains ALL classes of the selected layer,
even
> if I have zoomed to a very close scale (and I view only one class in
the
> map).
>
> Can you help me?
> Is it possible?
>
> Thank you,
>  Daniele
>



More information about the mapserver-users mailing list