[Mapserver-users] Re: Setting scale of map while using dbox
Emilio Mayorga
emiliom at u.washington.edu
Tue Feb 3 19:40:52 PST 2004
Jason,
I have a dbox application where the functionality you mention is working
just fine. It's borrowed from a couple of other applications, of
course... Anyways, here's the gist:
** Here's the FORM element:
<form name="scaleform" action="javascript:void(0)" onSubmit="return
change_scale()">
<input type="submit" value="Zoom to Scale:">
<input type="text" name="scale" maxlength="10" size="10">
</form>
** Which calls the change_scale function on submit:
function change_scale() {
var x = (ms.extent[0] + ms.extent[2])/2.0;
var y = (ms.extent[1] + ms.extent[3])/2.0;
ms.zoomscale(x, y, document.scaleform.scale.value);
return false;
}
Don't ask me to explain or justify every bit of code; in some cases I've
forgotten, in other cases I simply never bothered to learn why things
were the way they were in the code I borrowed.
Good luck.
-Emilio
------------------
I was wondering if anyone might be able to tell me how to go about
sumbitting a fixed scale (ie: typed in by user) to mapserver when using
the dbox stuff.
Below is an idea of how to get the scale set but I do not see where
"scale" is used in the mapserv.js file. I know a parameter can be passed
directly to mapserv cgi and I also noticed functions such as "function
Mapserv_setextentfromscale(x, y, scale)" but I dont see where I get my
coordinates from (ie: mapx, mapy if just using regular html).
I just have a refresh button at the moment to press once the scale is set.
<font class="fontbold">Scale=> 1:</font><input class="inputfield"
size="10" maxlength="10" type="text" name="scale_ratio" title="scale
ratio" alt="scale ratio" value="" onChange="ms.scale=this.value">
Would the right was to do this be to call the above function directly
with the x, y and scale?
More information about the MapServer-users
mailing list