Questions on layer display, Rosa applet

Stephen Lime steve.lime at
Thu Nov 9 15:21:15 EST 2000

Ignore STATUS settings other than DEFAULT. The mapserv CGI program
considers anything but DEFAULT to be OFF. Then the app looks for CGI
variables called "layer" the mapserver layer referenced by that layer, for
example lakes, is then considered ON. Study the demo.

See the attached applet and class files.

To use:

  1) place the class files on your site someplace (preferable in their own directory)
  2) add the following javascript functions to your application (in the <head> section)

  <script language="javascript">
      function mapplet_apply(name, minx, miny, maxx, maxy, redraw) {
        document.mapserv.imgbox.value = minx + " " + miny + " " + maxx + " " + maxy;
        document.mapserv.imgxy.value = minx + " " + miny;
      function mapplet_error(message) {

  3) add the following hidden variables to your mapserver form (make sure the form is named "mapserv", if you change
      it you'll need to edit the functions above to reflect that change)

  <input type="hidden" name="imgxy" value="149 199">
  <input type="hidden" name="imgbox" value="-1 -1 -1 -1">

  The values for imgxy should be matched to you're image size. The formulas are x = (cols-1)/2 and y = (rows-1)/2.

  4) change the <input type="image"...> part of your form to use the applet.

      <applet codebase="/mapping/java/mapplet" code="mapplet.class" width="300" height="400" name="mapplet" MAYSCRIPT>
              <param name="image" value="[img]">
              <param name="jitter" value="10">
              <param name="thickness" value="2">
              <param name="color" value="yellow">


         image = fully qualified URL for the image to be displayed
         jitter = the ammount of slop in mouse clicking (i.e. minimum box size)
         thickness = thickness of the dragged box (in pixels)
         color = color of the box (either a java named color or an rgb triplet - 0 0 0)

You'll have to edit the codebase, width, and height parameters to match your needs.

That should do it.


Stephen Lime
Internet Applications Analyst

Minnesota DNR
500 Lafayette Road
St. Paul, MN 55155

>>> "Ben Lewis" <benlewis1 at> 11/07/00 01:55PM >>>
Thanks for the quick response...
In the map file in the demo, all layers have status=on or status=default.  
How does the interface in the demo turn them on and off from the "select 
layers to display" box on the browser interface? When I highlight a layer to 
turn on and hit refresh, no change occurs and the layer i highlighted is no 
linger highlighted.  In the original demo any layers that are highlighted 
are turned on when the map is refreshed.

I hope this makes sense.

Yes, I would be very interested in the applet you mentioned.

Thanks again.

Ben Lewis
Advanced Technology Solutions, Inc.
Lancaster, PA

>From: "Stephen Lime" <steve.lime at>
>To: <benlewis1 at>
>Subject: Re: Questions on layer display, Rosa applet
>Date: Tue, 07 Nov 2000 12:59:38 -0600
>By default all layers are off and must be explicitly turned on. The 
>exception is
>layers of TYPE DEFAULT or QUERYONLY. The layer and layers CGI variables
>are used to specify which layers to turn on.
>BTW I have an alternative to Rosa that can be added to an application in a
>few minutes if you're interested.
>Stephen Lime
>Internet Applications Analyst
>Minnesota DNR
>500 Lafayette Road
>St. Paul, MN 55155
> >>> "Ben Lewis" <benlewis1 at> 11/07/00 10:50AM >>>
>I started with the demo and loaded my own data, everything is going well
>reprojection, query - except I can't get the layers to turn on and off.
>Status=default gets them on.  Status=on does not, but I cannot turn them on
>from the "Select Layers to Display"  window. Any help appreciated.
>BTW MapServer is fast.  I've got a 100 meg shape file I'm cruising around 
>4 second refresh times on a 260 megahertze!  That's indexed using shptree.
>One other question, the Rosa applet looks very nice, and I'm going to be
>giving a presentation on Open Source GIS, using MapServer (and the Rosa
>applet if possible) as an example of a great OS GIS web apps, and wanted to
>see if there was a quick how to that could get the applet running in an 
>or so. No big deal if it's more involved than that.
>Thank you.
>Ben Lewis
>Advanced Technology Solutions, Inc.
>Lancaster, PA
>Get Your Private, Free E-mail from MSN Hotmail at
>Share information about yourself, create your own public profile at

Get Your Private, Free E-mail from MSN Hotmail at

Share information about yourself, create your own public profile at

-------------- next part --------------
A non-text attachment was scrubbed...
Type: application/octet-stream
Size: 7475 bytes
Desc: not available
Url :
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mapplet.class
Type: application/octet-stream
Size: 6094 bytes
Desc: not available
Url :
-------------- next part --------------
A non-text attachment was scrubbed...
Name: evalThread.class
Type: application/octet-stream
Size: 1243 bytes
Desc: not available
Url :

More information about the mapserver-users mailing list