CGI Variables

Stephen Lime steve.lime at dnr.state.mn.us
Thu Jan 13 17:24:55 EST 2000


Ross: It's actually possible to do this without writing a new applet. There is a
public method called "newMap(string mapurl)" that is part of the mapimage
applet I posted awhile back. What it does is swap in the new image once it
has completely loaded. The url string is built by javascript which then calls the
public method etc. Of course if you want to use java-based controls then you'll
need something new. So, here's what those vars are:

  - imgext: the extent of the image the user is currently working from.
  - mapext: the extent of the image to be created.

(This is why you often see this in templates:

  <input type="hidden" name="imgext" value="[mapext]">

the map just created now becomes the working map. A bit confusing but it's the
way I kept things straight in the very begining.)

  - img.x and img.y: are the image coordinates for a users mouse click. The browser
    actually creates these from the <input type="image" name="img"...> line.

  - imgxy: you can't use javascript to manipulate img.x and img.y because of the .'s 
    in the name. So imgxy means exactly the same as img.x and img.y except that 
    both the x and y values are contained in one variable. If img.x, img.y and imgxy
    are set then the mouse click (i.e. img.x, img.y) takes precedence over anything
    set as a default or by javascript using imgxy.

Clear as mud? To use standard zooms you will have to mimic a standard forms
(i.e. like the demo) interface from within java. This means sending imgext (the
extend of the displayed image) AND a mouse click using imgxy. Note you can
do box zooms using imgext and imgbox. That being said, one thing to remember is 
that you're getting back an image and nothing else, no coordinate info, nothing. I 
think you'll have to manage the coordinates, zooms and everything on the client and
simply use mapext to request images. This is pretty easy to do. The C code is all
in the mapserv.c and you just need to grab the right parts and convert to java. Actually
the mapquakes.pl script I made reference to a while back shows you how to do
this too.

Steve


Stephen Lime
Internet Applications Analyst

Minnesota DNR
500 Lafayette Road
St. Paul, MN 55155
651-297-2937

>>> Searle Ross <Ross.Searle at dnr.qld.gov.au> 01/12/00 12:49AM >>>
Steve or any other wise person,

I am trying to create an applet that talks directly to mapserver so that you
do not actually submit the HTML page but rather the applet submits the URL
and processes the returned info and updates the image inside the applet. The
upshot of this being that the whole HTML page doesn't have to be refreshed
only the applet. This is all working fine. I am trying to use zoomin
functions etc similar to your applet. Since the applet submits the URL I
need to know what CGI variables are actually controlling mapextents etc of
the returned image so that I can build the appropriate URL.

I was wondering if you could give some further info on how mapserver
processes the CGI variables and their importance. In particular imgext,
mapext, imgxy, img.x, img.y. I have been trying to work out by a process of
elimination what goes on but the only thing I am eliminating is scarce brain
cells. I know this is all a bit vague but an example of what I am concerned
with is - I have been able to control the zoom by generating mapextents but
then when I do a query I get messages such as "imgxy not set"

It would be nice to get a brief overview of how mapserver processes these
variables

Thanks
Ross


Ross Searle
Natural Resource Information Management Officer
Department of Natural Resources
PO Box 1143 
Bundaberg QLD 4670. Australia
Ph : 0741 537 888 Fax : 0741 537 823





More information about the mapserver-users mailing list