Zoom to full extent

Stephen Lime steve.lime at dnr.state.mn.us
Wed Mar 14 08:08:32 PST 2001


The way I've done that is to store the default extent IN the EXTENT parameter.
The MapServer will fall back to that value if no other extent is given which saves
screwing around with other parameters. Then I create a javascript function that
detects when the right radio button is checked, like:

function zoomfull() {
  for(var i=0; i<document.mapserv.zoomdir.length; i++) {
    if(document.mapserv.zoomdir[i].checked && document.mapserv.zoomdir[i].value == 'full') {
      var url = 'http://[host]:[port]/cgi-bin/mapserv?map=[map]';
      window.location = url; // redirect to the 'full' url
    }
  }
}

Then in your form you add a radio button for the 'full' case. This is off the top of my head so the
syntax might be off a bit, but it's close. Note there doesn't have to be an extent since the default
is in the mapfile. You could augment this easily to tag on current layers, zoomsizes and so on.

Steve

Stephen Lime
Internet Applications Analyst

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

>>> Robert Stanton <geosys at iafrica.com> 03/13/01 10:12AM >>>
I have been trying to create a radio button, along with my zoom and pan
buttons, that would expand a map to its original full extent, using [mapxy]
and [scale], to no avail. I would be grateful if someone could tell me if
I'm on the right idea, and if so what the exact syntax of the radio input
would be.

Thanks in advance

Robert Stanton





More information about the MapServer-users mailing list