[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: [mapserver-users] Fwd: full extent



I borrowed this javascript function from the mapserver mail archive and it works for me. Just put this code in the head block of your HTML page:

<SCRIPT language=JavaScript>
function goGlobal() {
//select the Pan option so we won't zoom in when clicking "full extent"
document.mapserv.zoomdir.value = 1; // NOTE that my HTML form is named "mapserv"
document.mapserv.zoomsize.value = 2; // Use your form's name here after "document."
//set image extent to the extent value in your map file
// map extent is 33.709580 -4.999999 41.891010 5.682579
document.mapserv.imgext.value = "30.109580 -4.999999 48.891010 6.082579";
document.mapserv.imgbox.value = "-1 -1 -1 -1"; //used with the mapplet
//set center pixel coordinates - my image size is 565 by 670
document.mapserv.imgxy.value = "232.5 335.0";
document.mapserv.submit();
}
</SCRIPT>

then call the function from any image (for example) using the "onClick" action like this:

<img src="global.jpg" onClick="goGlobal();">

Hope this helps,

Mike Smith

Steve Lime wrote:

------------------------------------------------------------------------

Subject:

full extent
From:

Rob Holloway <rholloway_1999@yahoo.com>
Date:

Wed, 4 Sep 2002 11:14:46 -0700 (PDT)
To:

mapserver-info@lists.gis.umn.edu


Hi

I'm trying to create a zoom to full extent button
without much success.  Does anyone have any
suggestions/code to offer.  Thanks!

Rob

__________________________________________________
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com