[Mapserver-users] Checkboxes for layer control

Steve McCrone mccrone at pc.jaring.my
Tue Jan 7 06:06:32 PST 2003


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"">  =

<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"> States</td>
          <td width=3D"52%" height=3D"5"> </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"> Water Features</td>
          <td width=3D"52%" height=3D"2"> </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> </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.  It looks pretty darn simple but I can't seem to get =
it=20
working.  The checkboxes are to reflect what layers are loaded, but =
they=20
are not.  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> </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> </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><html><=
BR><head><BR><title>MapServer=20
3.5 Tutorial</title><BR></head><BR><body=20
bgcolor=3D"#ffffff"><BR><form method=3DGET=20
action=3D"/cgi-bin/mapserv.exe"></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2><input type=3D"hidden" name=3D"map"=20
value=3D"C:\Inetpub\wwwroot\s1ex1.map"><BR><input type=3D"hidden"=20
name=3D"zoomsize" value=3D2><BR><input type=3D"hidden" =
name=3D"program"=20
value=3D"/cgi-bin/mapserv.exe"><BR><input type=3D"hidden"=20
name=3D"map_web_imagepath" =
value=3D"C:\inetpub\wwwroot\tmp\"><BR><input=20
type=3D"hidden" name=3D"map_web_imageurl"=20
value=3D"/tmp/"><BR><center><input type=3D"submit"=20
value=3D"Initialize"></center><BR></body><BR></html>=
</FONT></DIV>
<DIV> </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> </DIV>
<DIV><FONT face=3DArial size=3D2>WEB<BR>  TEMPLATE =
s1ex1.html<BR> =20
IMAGEPATH "set in index.html"<BR>  IMAGEURL "set in=20
index.html"<BR>END</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>LAYER # water<BR>  NAME =
"water"<BR>  DATA=20
hydrop_ugl<BR>  STATUS DEFAULT<BR>  TYPE POLYGON</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>  CLASS<BR>    NAME =

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

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

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

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

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

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





More information about the MapServer-users mailing list