[Mapserver-users] Checkboxes for layer control

Steve McCrone mccrone@pc.jaring.my
Tue, 7 Jan 2003 22:06:32 +0800


This is a multi-part message in MIME format.

------=_NextPart_000_0007_01C2B699.09B280A0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

I'm trying to implement check boxes to toggle on/off layers.  It looks =
pretty darn simple but I can't seem to get it working.  The checkboxes =
are to reflect what layers are loaded, but they are not.  I've tried for =
many hours but once again must resort to the list. So I'm really hoping =
that someone can point out my mistake(s).

My original had the rosa applet in it and it was working great. But I =
took it out in the code below to see if that made a difference, so there =
is some declarations in the template file that do not currently apply.

I start with index.html
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
<html>
<head>
<title>MapServer 3.5 Tutorial</title>
</head>
<body bgcolor=3D"#ffffff">
<form method=3DGET action=3D"/cgi-bin/mapserv.exe">

<input type=3D"hidden" name=3D"map" =
value=3D"C:\Inetpub\wwwroot\s1ex1.map">
<input type=3D"hidden" name=3D"zoomsize" value=3D2>
<input type=3D"hidden" name=3D"program" value=3D"/cgi-bin/mapserv.exe">
<input type=3D"hidden" name=3D"map_web_imagepath" =
value=3D"C:\inetpub\wwwroot\tmp\">
<input type=3D"hidden" name=3D"map_web_imageurl" value=3D"/tmp/">
<center><input type=3D"submit" value=3D"Initialize"></center>
</body>
</html>

s1ex1.map
=3D=3D=3D=3D=3D=3D=3D
NAME S1EX1
EXTENT -97.238976 41.619778 -82.122902 49.38562
SIZE 500 400
SHAPEPATH "data"

WEB
  TEMPLATE s1ex1.html
  IMAGEPATH "set in index.html"
  IMAGEURL "set in index.html"
END

LAYER # water
  NAME "water"
  DATA hydrop_ugl
  STATUS DEFAULT
  TYPE POLYGON

  CLASS
    NAME "water"
    COLOR 200 200 255
    OUTLINECOLOR 255 0 0
  END # end of water features class
END  # end of water features layer

LAYER # States
  NAME "states"
  DATA states_ugl
  STATUS DEFAULT
  TYPE POLYGON

  CLASS # States class
    NAME "States"
    EXPRESSION ('[CLASS]' =3D 'land')
    COLOR 240 240 240
    OUTLINECOLOR 0 0 0
  END # end of States class object
END # end of layer object

END # end of map file

s1ex1.html
=3D=3D=3D=3D=3D=3D=3D=3D
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<title>Part1, Example 1</title>
</head>
<h3>Section 1- Example 1</h3>

<form name=3D"mapserver" method=3Dget action=3D"/cgi-bin/mapserv.exe" =
onSubmit=3D"zoomin()">

<input type=3D"hidden" name=3D"mode" value=3D"browse">
<input type=3D"hidden" name=3D"zoomdir" value=3D"1">
<input type=3D"hidden" name=3D"zoomsize" value=3D"2">

<input type=3D"hidden" name=3D"map" value=3D"[map]">
<input type=3D"hidden" name=3D"imgext" value=3D"[mapext]">
<!-- <input type=3D"hidden" name=3D"imgxy" value=3D"250 200">-->


<input type=3D"hidden" name=3D"map_web_imagepath" =
value=3D"[map_web_imagepath]">
<input type=3D"hidden" name=3D"map_web_imageurl" =
value=3D"[map_web_imageurl]">


 <!-- ROSA applet specific tags  -->
    <input type=3D"hidden" name=3D"imagewidth" value=3D"[mapwidth]">
    <input type=3D"hidden" name=3D"imageheight" value=3D"[mapheight]">
    <!-- Initialization of the parameters which can be set from the =
applet  -->
    <input type=3D"hidden" name=3D"INPUT_TYPE"  value=3D"">
    <input type=3D"hidden" name=3D"INPUT_COORD" value=3D"">

    <input type=3D"hidden" name=3D"lastButtonSelected" value=3D"">&nbsp; =

<table border=3D"1" width=3D"771" height=3D"82" cellpadding=3D"2">
  <tr>
    <td width=3D"400" height=3D"27" valign=3D"top" align=3D"left">
      <table border=3D"1" width=3D"100%" height=3D"83">
        <tr>
          <td width=3D"13%" height=3D"5">
          <input type=3D"checkbox" name=3D"layer" value=3D"states" =
[states_check]>
          </td>
          <td width=3D"35%" height=3D"5">&nbsp;States</td>
          <td width=3D"52%" height=3D"5">&nbsp;</td>
        </tr>
        <tr>
          <td width=3D"13%" height=3D"2">
          <input type=3D"checkbox" name=3D"layer" value=3D"water" =
[water_check]>
          </td>
          <td width=3D"35%" height=3D"2">&nbsp;Water Features</td>
          <td width=3D"52%" height=3D"2">&nbsp;</td>
        </tr>
        <tr>
          <td width=3D"13%" height=3D"29">
          <input type=3DIMAGE =
src=3D"rosa/userdoc/images/icon_redraw.gif" width=3D"19" height=3D"19" =
name=3Dredraw border=3D0></td>
          <td width=3D"87%" height=3D"29" colspan=3D"2"><font =
face=3D"Arial" size=3D"3">Redraw
            Map</font></td>
        </tr>
      </table>
    </td>
    <td width=3D"507" height=3D"363" valign=3D"top" align=3D"left" =
bordercolor=3D"#000080">
    <INPUT NAME=3D"img" TYPE=3D"image" SRC=3D"[img]" width=3D[mapwidth] =
height=3D[mapheight] border=3D0>
    </td>
  </tr>
  <tr>
    <td width=3D"400" height=3D"43" valign=3D"top" align=3D"left"></td>
    <td width=3D"507" height=3D"43"></td>
  </tr>
</table>
<p>
=20
   <!-- Applet and Parameter -->
</p>
<p>&nbsp;</p>
</form>
</html>


------=_NextPart_000_0007_01C2B699.09B280A0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 5.50.4134.600" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>I'm trying to implement check boxes to =
toggle=20
on/off layers.&nbsp; It looks pretty darn simple but I can't seem to get =
it=20
working.&nbsp; The checkboxes are to reflect what layers are loaded, but =
they=20
are not.&nbsp; I've tried for many hours but once again must resort to =
the list.=20
So I'm really hoping that someone can point out my =
mistake(s).</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>My original had the rosa applet in it =
and it was=20
working great. But I took it out in the code below to see if that made a =

difference, so there is some declarations in the template file that do =
not=20
currently apply.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I start with=20
index.html<BR>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D<BR>&lt;html&gt;<=
BR>&lt;head&gt;<BR>&lt;title&gt;MapServer=20
3.5 Tutorial&lt;/title&gt;<BR>&lt;/head&gt;<BR>&lt;body=20
bgcolor=3D"#ffffff"&gt;<BR>&lt;form method=3DGET=20
action=3D"/cgi-bin/mapserv.exe"&gt;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&lt;input type=3D"hidden" name=3D"map"=20
value=3D"C:\Inetpub\wwwroot\s1ex1.map"&gt;<BR>&lt;input type=3D"hidden"=20
name=3D"zoomsize" value=3D2&gt;<BR>&lt;input type=3D"hidden" =
name=3D"program"=20
value=3D"/cgi-bin/mapserv.exe"&gt;<BR>&lt;input type=3D"hidden"=20
name=3D"map_web_imagepath" =
value=3D"C:\inetpub\wwwroot\tmp\"&gt;<BR>&lt;input=20
type=3D"hidden" name=3D"map_web_imageurl"=20
value=3D"/tmp/"&gt;<BR>&lt;center&gt;&lt;input type=3D"submit"=20
value=3D"Initialize"&gt;&lt;/center&gt;<BR>&lt;/body&gt;<BR>&lt;/html&gt;=
</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial =
size=3D2>s1ex1.map<BR>=3D=3D=3D=3D=3D=3D=3D<BR>NAME S1EX1<BR>EXTENT=20
-97.238976 41.619778 -82.122902 49.38562<BR>SIZE 500 400<BR>SHAPEPATH=20
"data"</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>WEB<BR>&nbsp; TEMPLATE =
s1ex1.html<BR>&nbsp;=20
IMAGEPATH "set in index.html"<BR>&nbsp; IMAGEURL "set in=20
index.html"<BR>END</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>LAYER # water<BR>&nbsp; NAME =
"water"<BR>&nbsp; DATA=20
hydrop_ugl<BR>&nbsp; STATUS DEFAULT<BR>&nbsp; TYPE POLYGON</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp; CLASS<BR>&nbsp;&nbsp;&nbsp; NAME =

"water"<BR>&nbsp;&nbsp;&nbsp; COLOR 200 200 255<BR>&nbsp;&nbsp;&nbsp;=20
OUTLINECOLOR 255 0 0<BR>&nbsp; END # end of water features =
class<BR>END&nbsp; #=20
end of water features layer</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>LAYER # States<BR>&nbsp; NAME =
"states"<BR>&nbsp;=20
DATA states_ugl<BR>&nbsp; STATUS DEFAULT<BR>&nbsp; TYPE =
POLYGON</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp; CLASS # States =
class<BR>&nbsp;&nbsp;&nbsp;=20
NAME "States"<BR>&nbsp;&nbsp;&nbsp; EXPRESSION ('[CLASS]' =3D=20
'land')<BR>&nbsp;&nbsp;&nbsp; COLOR 240 240 240<BR>&nbsp;&nbsp;&nbsp;=20
OUTLINECOLOR 0 0 0<BR>&nbsp; END # end of States class object<BR>END # =
end of=20
layer object</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>END # end of map file</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial =
size=3D2>s1ex1.html<BR>=3D=3D=3D=3D=3D=3D=3D=3D<BR>&lt;!DOCTYPE HTML =
PUBLIC=20
"-//IETF//DTD=20
HTML//EN"&gt;<BR>&lt;html&gt;<BR>&lt;head&gt;<BR>&lt;title&gt;Part1, =
Example=20
1&lt;/title&gt;<BR>&lt;/head&gt;<BR>&lt;h3&gt;Section 1- Example=20
1&lt;/h3&gt;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&lt;form name=3D"mapserver" =
method=3Dget=20
action=3D"/cgi-bin/mapserv.exe" onSubmit=3D"zoomin()"&gt;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&lt;input type=3D"hidden" name=3D"mode" =

value=3D"browse"&gt;<BR>&lt;input type=3D"hidden" name=3D"zoomdir"=20
value=3D"1"&gt;<BR>&lt;input type=3D"hidden" name=3D"zoomsize"=20
value=3D"2"&gt;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&lt;input type=3D"hidden" name=3D"map"=20
value=3D"[map]"&gt;<BR>&lt;input type=3D"hidden" name=3D"imgext"=20
value=3D"[mapext]"&gt;<BR>&lt;!-- &lt;input type=3D"hidden" =
name=3D"imgxy" value=3D"250=20
200"&gt;--&gt;</FONT></DIV>
<DIV>&nbsp;</DIV><FONT face=3DArial size=3D2>
<DIV><BR>&lt;input type=3D"hidden" name=3D"map_web_imagepath"=20
value=3D"[map_web_imagepath]"&gt;<BR>&lt;input type=3D"hidden"=20
name=3D"map_web_imageurl" value=3D"[map_web_imageurl]"&gt;</DIV>
<DIV>&nbsp;</DIV>
<DIV><BR>&nbsp;&lt;!-- ROSA applet specific tags&nbsp;=20
--&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;input type=3D"hidden" =
name=3D"imagewidth"=20
value=3D"[mapwidth]"&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;input type=3D"hidden" =

name=3D"imageheight" value=3D"[mapheight]"&gt;<BR>&nbsp;&nbsp;&nbsp; =
&lt;!--=20
Initialization of the parameters which can be set from the applet&nbsp;=20
--&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;input type=3D"hidden" =
name=3D"INPUT_TYPE"&nbsp;=20
value=3D""&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;input type=3D"hidden" =
name=3D"INPUT_COORD"=20
value=3D""&gt;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;&nbsp;&nbsp; &lt;input type=3D"hidden" =
name=3D"lastButtonSelected"=20
value=3D""&gt;&amp;nbsp; <BR>&lt;table border=3D"1" width=3D"771" =
height=3D"82"=20
cellpadding=3D"2"&gt;<BR>&nbsp; &lt;tr&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;td=20
width=3D"400" height=3D"27" valign=3D"top"=20
align=3D"left"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;table =
border=3D"1"=20
width=3D"100%" =
height=3D"83"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
&lt;tr&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&lt;td=20
width=3D"13%"=20
height=3D"5"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;=20
&lt;input type=3D"checkbox" name=3D"layer" value=3D"states"=20
[states_check]&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;=20
&lt;/td&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&lt;td=20
width=3D"35%"=20
height=3D"5"&gt;&amp;nbsp;States&lt;/td&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
&lt;td width=3D"52%"=20
height=3D"5"&gt;&amp;nbsp;&lt;/td&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;=20
&lt;/tr&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
&lt;tr&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&lt;td=20
width=3D"13%"=20
height=3D"2"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;=20
&lt;input type=3D"checkbox" name=3D"layer" value=3D"water"=20
[water_check]&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;=20
&lt;/td&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&lt;td=20
width=3D"35%" height=3D"2"&gt;&amp;nbsp;Water=20
Features&lt;/td&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;=20
&lt;td width=3D"52%"=20
height=3D"2"&gt;&amp;nbsp;&lt;/td&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;=20
&lt;/tr&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
&lt;tr&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&lt;td=20
width=3D"13%"=20
height=3D"29"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;=20
&lt;input type=3DIMAGE src=3D"rosa/userdoc/images/icon_redraw.gif" =
width=3D"19"=20
height=3D"19" name=3Dredraw=20
border=3D0&gt;&lt;/td&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;=20
&lt;td width=3D"87%" height=3D"29" colspan=3D"2"&gt;&lt;font =
face=3D"Arial"=20
size=3D"3"&gt;Redraw<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;=20
Map&lt;/font&gt;&lt;/td&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
=20
&lt;/tr&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
&lt;/table&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;/td&gt;<BR>&nbsp;&nbsp;&nbsp; =
&lt;td=20
width=3D"507" height=3D"363" valign=3D"top" align=3D"left"=20
bordercolor=3D"#000080"&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;INPUT NAME=3D"img" =

TYPE=3D"image" SRC=3D"[img]" width=3D[mapwidth] height=3D[mapheight]=20
border=3D0&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;/td&gt;<BR>&nbsp; =
&lt;/tr&gt;<BR>&nbsp;=20
&lt;tr&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;td width=3D"400" height=3D"43" =
valign=3D"top"=20
align=3D"left"&gt;&lt;/td&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;td width=3D"507" =

height=3D"43"&gt;&lt;/td&gt;<BR>&nbsp;=20
&lt;/tr&gt;<BR>&lt;/table&gt;<BR>&lt;p&gt;<BR>&nbsp;<BR>&nbsp;&nbsp; =
&lt;!--=20
Applet and Parameter=20
--&gt;<BR>&lt;/p&gt;<BR>&lt;p&gt;&amp;nbsp;&lt;/p&gt;<BR>&lt;/form&gt;<BR=
>&lt;/html&gt;<BR></FONT></DIV></BODY></HTML>

------=_NextPart_000_0007_01C2B699.09B280A0--


_______________________________________________
Mapserver-users mailing list
Mapserver-users@lists.gis.umn.edu
http://lists.gis.umn.edu/mailman/listinfo/mapserver-users