[Chameleon] problem when hiding layers in legend
Jennifer Shanks
jennifer at greeninfo.org
Fri Jan 20 15:31:41 EST 2006
Hello,
I used some code from the list in order to hide a few layers from
displaying in the legend (hillshade, water, etc).
In the metadata section of each layer I'd like to hide, I
use: SHOWINLEGEND "nope" and in the legend_template.html file, I
included: [if name=SHOWINLEGEND oper=isnull][/if]
This works fine until I update the map. After updating the map only
the layers visible in the legend show up on the map. All of the
other layers disappear.
Any suggestions?
Here's my mapfile and legend_template.html:
Thanks once again for the help.
Regards,
Jennifer
#
# Start of map file
#
# Sample map file for a chameleon app.
#
NAME DEMO
STATUS ON
SIZE 360 360
SYMBOLSET ../etc/symbols.sym
EXTENT 440057.57 4079087.55 675801.58 4300037.25
UNITS METERS
SHAPEPATH "../data"
IMAGECOLOR 255 255 255
FONTSET ../etc/fonts.txt
TRANSPARENT FALSE
IMAGETYPE png24
#
# Start of web interface definition
#
WEB
MINSCALE 30000
MAXSCALE 20000000
#
# On Windows systems, /tmp and /tmp/ms_tmp/ should be created at the root
# of the drive where the .MAP file resides.
#
IMAGEPATH "/ms4w/tmp/ms_tmp/"
IMAGEURL "/ms_tmp/"
# LOG "/tmp/gmap.log"
METADATA
END #Metadata
END #Web
#
# Start of reference map
#
REFERENCE
IMAGE images/keymap.gif
EXTENT 440057.57 4079087.55 675801.58 4300037.25
STATUS ON
COLOR -1 -1 -1
OUTLINECOLOR 255 0 0
SIZE 90 90
END #Reference
#
# Start of legend
#
LEGEND
KEYSIZE 18 12
LABEL
TYPE BITMAP
SIZE MEDIUM
COLOR 0 0 89
END #label
STATUS ON
END #legend
#
# Start of scalebar
#
SCALEBAR
IMAGECOLOR 255 255 255
LABEL
COLOR 0 0 0
SIZE SMALL
END #label
SIZE 150 5
COLOR 255 255 255
BACKGROUNDCOLOR 0 0 0
OUTLINECOLOR 0 0 0
UNITS miles
INTERVALS 5
STATUS ON
END #scalebar
QUERYMAP
STATUS ON
STYLE Hilite
COLOR 255 0 0
END #querymap
PROJECTION
"init=epsg:32610"
END #projection
#
# Start of layer definitions
#
LAYER
GROUP "Polygon"
NAME "County Boundaries"
STATUS ON
METADATA
"DESCRIPTION" "County Boundaries"
"GROUP" "Polygon"
"LAYER" "cty24utm"
SHOWINLEGEND "nope"
END #metadata
TYPE POLYGON
DATA cty24utm
CLASS
NAME "County Boundaries"
COLOR 245 239 214
END #class
PROJECTION
"init=epsg:32610"
END #projection
END # layer
LAYER
GROUP "Polygon"
NAME "Parks"
STATUS ON
METADATA
"DESCRIPTION" "Parks"
"RESULT_FIELDS" "HOLD_NAME"
"GROUP" "Polygon"
"LAYER" "parks_pub_diss.shp"
END #metadata
TYPE POLYGON
DATA "parks_pub_diss.shp"
LABELCACHE on
LABELITEM "HOLD_NAME"
LABELMAXSCALE 200000
CLASS
EXPRESSION ('[Min_ACCESS]' eq 'Restricted Public Access')
NAME "Open Space"
COLOR 194 222 128
OUTLINECOLOR 171 195 112
TEMPLATE "ttt_query.html"
LABEL
TYPE truetype
FONT "sans"
SIZE 7
COLOR 1 139 132
OUTLINECOLOR 255 255 255
MINDISTANCE 300
POSITION cc
WRAP ' '
MINFEATURESIZE 40
END #LABEL
END #class
CLASS
EXPRESSION ('[Min_ACCESS]' eq 'Open Public Access')
NAME "Open Space"
COLOR 135 187 126
OUTLINECOLOR 104 159 95
TEMPLATE "ttt_query.html"
LABEL
TYPE truetype
FONT "sans"
SIZE 7
COLOR 1 139 132
OUTLINECOLOR 255 255 255
MINDISTANCE 300
POSITION cc
WRAP ' '
MINFEATURESIZE 40
END #LABEL
END #class
TOLERANCE 5
PROJECTION
"init=epsg:32610"
END #projection
END # Layer
LAYER
GROUP "Raster"
NAME "Hillshade"
STATUS ON
PROCESSING "COLOR_MATCH_THRESHOLD=7"
MAXSCALE 1000000
TRANSPARENCY 20
METADATA
"DESCRIPTION" "Elevation/Hillshade"
"GROUP" "Raster"
"LAYER" "hillshade"
SHOWINLEGEND "nope"
END #metadata
TYPE RASTER
DATA sfbay_30m_hlshd_blur.tif
PROJECTION
"init=epsg:32610"
END #projection
END #layer
LAYER
GROUP "Line"
NAME "County Line"
STATUS ON
METADATA
"DESCRIPTION" "County Line"
"GROUP" "Line"
"LAYER" "cty24_ln"
SHOWINLEGEND "nope"
END #metadata
TYPE LINE
DATA cty24_ln
TRANSPARENCY 70
CLASS
NAME "County Line"
STYLE
COLOR 245 227 210
SYMBOL 'Solid_ln'
SIZE 4
END
STYLE
COLOR 205 135 73
SYMBOL 'countyl'
SIZE 1
END
END #class
PROJECTION
"init=epsg:32610"
END #projection
END # layer
LAYER
GROUP "Polygon"
NAME "Bay & Ocean"
STATUS ON
METADATA
"DESCRIPTION" "Bay & Ocean"
"GROUP" "Polygon"
"LAYER" "bay_ocean_trim"
SHOWINLEGEND "nope"
END #metadata
TYPE POLYGON
DATA bay_ocean_trim
CLASS
NAME "Bay & Ocean"
COLOR 233 239 245
OUTLINECOLOR 194 213 232
END #class
PROJECTION
"init=epsg:32610"
END #projection
END # layer
LAYER
GROUP "Line"
NAME "Trails"
STATUS ON
METADATA
"DESCRIPTION" "Trails"
"GROUP" "Line"
"LAYER" "trails_current"
END #metadata
TYPE LINE
TEMPLATE "ttt_query.html"
MAXSCALE 800000
DATA trails_current
CLASS
EXPRESSION ('[STATUS]' eq 'Existing')
NAME "Trails"
SIZE 1
SYMBOL 'dashed'
COLOR 160 119 85
END #class
PROJECTION
"init=epsg:32610"
END #projection
TOLERANCE 10
END # Layer
#Campgrounds
LAYER
GROUP "Point"
NAME "Campgrounds"
STATUS ON
METADATA
"DESCRIPTION" "Campgrounds"
"GROUP" "Point"
"LAYER" "campgrounds"
END #metadata
TYPE POINT
DATA campgrounds
CLASS
NAME "Campgrounds"
TEMPLATE "ttt_query.html"
SIZE 7
SYMBOL 6
COLOR 255 0 0
END #class
PROJECTION
"init=epsg:32610"
END #projection
TOLERANCE 5
END # Layer
SYMBOL
NAME 'dashed'
TYPE ELLIPSE
POINTS 1 1 END
FILLED true
STYLE 3 3 3 3 END
END
SYMBOL
NAME 'Solid_ln'
TYPE ELLIPSE
POINTS 1 1 END
FILLED true
END
SYMBOL
NAME 'countyl'
TYPE ELLIPSE
POINTS 1 1 END
FILLED true
STYLE 5 5 5 5 END
END
END # Map File
[leg_layer_html order=ascending opt_flag=15]
[if name=SHOWINLEGEND oper=isnull]
<tr>
<td align="center" width=20><input type="checkbox"
name="legendlayername[]" value="[leg_layer_name]"
[if name=layer_status oper=eq value=1]CHECKED[/if]
[if name=layer_status oper=eq value=2]CHECKED[/if]></td>
<td><img src="[leg_icon width=20 height=18]" width="20" height="20"</td>
[if name=wms_name oper=isnull]
<td><a href="#"
onclick="javascript:LegendTemplateLayerInfo('[leg_layer_name]');"><span
class="label">[leg_layer_name]</span></a></td>
</tr>
[/if]
[if name=wms_name oper=isset]
<td><a href="#"
onclick="javascript:LegendTemplateLayerInfo('[leg_layer_name]');"><span
class="label">[metadata name=WMS_TITLE]</span></a></td>
</tr>
[/if]
[/if]
[/leg_layer_html]
****************************
Jennifer Shanks
GreenInfo Network
116 New Montgomery, Suite 738
San Francisco, CA 94105
(415) 979-0343 x 306
(415) 979-0371 FAX
**GreenInfo has completely re-done our web site
Go to: www.greeninfo.org
More information about the Chameleon
mailing list