[Mapserver-users] Zoom In to a defined area
Lowther, David W
dlowther at ou.edu
Wed Sep 3 05:56:46 PDT 2003
Jeff,
First - yes, it is correct to set IMGEXT.
Your problem is with javascript - that was my biggest hurdle also.
What you want to do is:
A - get the value of the selected element of the combo box
B - assign it to imgext in your mapserv form
C - submit the form.
Only javascript could make this difficult...
Try this:
function AreaSelected(){
msForm = document.myform;
//a
newExtent =
msForm.ViewArea.options[msForm.ViewArea.selectedIndex].value;
//b
msForm.imgext.value = newExtent;
//c
msForm.submit();
}
Dave
> -----Original Message-----
> From: Jeff L. [mailto:nf10 at hotmail.com]
> Sent: Wednesday, September 03, 2003 7:34 AM
> To: dlowther at ou.edu; palle at mail-online.dk;
> mapserver-users at lists.gis.umn.edu
> Subject: Re: [Mapserver-users] Zoom In to a defined area
>
>
> Hi Palle and David,
>
> I tried to change my code by setting mapext to the ViewArea
> value, but no
> success so far.
> When i select an option from my combo box, the map is
> redrawed but with the
> old mapext value.
> It's seems that i'm not setting correctly the new mapext.
> MapServer is using
> it's mapext value not the one i'm setting.
>
> I'm using this code snippet. Any help how to set correctly mapext is
> appreciated.
>
> function AreaSelected()
> {
> if (document.forms[0].ViewArea.selectedIndex != 0 &&
> document.forms[0].ViewArea.selectedIndex !=1)
> {
> mapext = document.forms[0].ViewArea.value;
> document.forms[0].submit();
> }
> }
> ...
>
> <form method=GET action="[program]" name=myform>
> ...
>
> <SELECT NAME="ViewArea" onChange="AreaSelected()">
> <OPTION VALUE="">Go to</OPTION>
> <OPTION VALUE="">- - - - - - - - - - - - - </OPTION>
> <OPTION VALUE="-180 45 180 90">Area 1</OPTION>
> <OPTION VALUE="-180 0 180 45">Area 2</OPTION>
> </SELECT >
>
> ...
> <input type="hidden" name="imgxy" value="299.5 299.5">
> <input type="hidden" name="imgext" value="[mapext]"> // Is
> this is correct
> ?
> ....
>
> </form>
>
>
>
> Jeff Lacoste
>
> _________________________________________________________________
> MSN 8 with e-mail virus protection service: 2 months FREE*
> http://join.msn.com/?page=features/virus
>
>
>
More information about the MapServer-users
mailing list