[mapserver-users] How to keep map from zooming/panning when I refresh?

Mike Smith nospam at cnrit.tamu.edu
Wed Sep 11 11:45:48 EDT 2002


Thanks!  I ended up trying the same exact thing this morning, before I 
even read this email...I guess I finally saw the light...and it's 
working now!  My javascript function looks almost identical to yours, 
thanks for the help!

Matthew Hatcher wrote:

> Here is the Javascript function that I use. I think the problem is 
> that the values for your map click location are kept from the last pan 
> or zoom, so that when the map refreshes it thinks you have clicked 
> off-centre. (this is just my laymans interpretation of it, so don't 
> flame me if that's wrong!)
>
> Anyway, this little script works for me:
>
>         // update the map without panning or zooming
>         function updateMap() {
>                 document.mapserv.mode.value = "browse";
>                 document.mapserv.target = "_self";
>                 document.mapserv.zoomdir.value = "0";
>                 document.mapserv.imgext.value = "[minx] [miny] [maxx] 
> [maxy]";
>                 document.mapserv.imgxy.value = "299.5 215.5";
>                 document.mapserv.submit();
>         }
>
> I have attached this function to all the checkboxes I use to turn 
> layers on/off, so when the user clicks on one it automatically 
> updates, and seems to work nicely without panning or zooming.
>
> You'll need to change the values in imgxy to reflect your half-image 
> width/height, and also may need to change the document.mapserv if 
> you've called your settings form something different.
>
> Good luck!
> Matt.
>
> -----Original Message-----
> From: Mike Smith [ mailto:nospam at cnrit.tamu.edu ]
> Sent: 06 September 2002 14:53
> To: Martin, Daniel
> Cc: mapserver-users at lists.gis.umn.edu
> Subject: Re: [mapserver-users] How to keep map from zooming/panning when
> I refresh?
>
>
> Thanks for this.  This sorta worked...it kept my image from zooming in,
> but then it panned to the right for some reason?!  I'm not sure what's
> up with that, but the other problem is that I've got to keep the
> "zoomdir" variable set because I keep the state of my "Zoom In",  "Zoom
> Out", and "Pan" buttons based on the value of this variable, so setting
> it to null resets all my buttons.  Regardless of my implementation,
> though, I even had this problem with the Itasca Demo...  I'm just
> wondering if anybody else figured out a way to alter the image without
> the Mapserver CGI program reading and executing your zoomdir variable.
>
> Thanks for the help, though...anybody else have any ideas?
>
> MIke
>
> Martin, Daniel wrote:
>
> >Whoops, I messed up the JavaScript.  This is a correction, note 
> ".value" is
> >added:
> >
> >function UpdateMap() {
> >    document.forms.mapserv.zoomdir.value = "";
> >    document.mapserv.submit();  
> >}
> >
> >
> >-----Original Message-----
> >From: Martin, Daniel
> >Sent: Thursday, September 05, 2002 11:47 AM
> >To: 'Mike Smith'; mapserver-users at lists.gis.umn.edu
> >Subject: RE: [mapserver-users] How to keep map from zooming/panning when
> >I refresh?
> >
> >
> >I think this will work:
> >
> >function UpdateMap() {
> >    document.forms.mapserv.zoomdir = "";
> >    document.mapserv.submit();  
> >}
> >
> >Or perhaps I'm missing something.  I do exactly what you say in my 
> client,
> >but I use Rosa to control zooming and panning, so it is a bit different.
> >
> >-Dan
> >
> >-----Original Message-----
> >From: Mike Smith [ mailto:nospam at cnrit.tamu.edu ]
> >Sent: Thursday, September 05, 2002 10:01 AM
> >To: mapserver-users at lists.gis.umn.edu
> >Subject: [mapserver-users] How to keep map from zooming/panning when I
> >refresh?
> >
> >
> >Hello,
> >
> >    I've got my page working pretty well now thanks to lots of
> >Javascript code I borrowed from this mailing list, but I've still got
> >one problem that I can't seem to find a solution for in the archives.
> > I've got my page set up so that the various layers that are available
> >to view are in a list on the right-hand side of the page with checkboxes
> >next to them.  And since I wanted the behavior of the page to imitate
> >ArcView as much as possible (because most of my users are used to that
> >interface) I put in a little javascript function that automatically
> >reloads the page whenever they check or uncheck a layer (without having
> >to click a "refresh" button).  My problem is that the layer loads or
> >unloads fine, but my image also pans or zooms at the same time depending
> >on what function they have checked.  How can I make my page reload
> >without changing the current view at all?  Even if they have the "Zoom
> >In" button clicked and the zoomsize is set to "2" I don't want the page
> >to zoom in when they just add a new layer.  Is there a value that I can
> >set "zoomdir" to besides 1, 0, or -1 that basically disables panning and
> >zooming altogether?
> >
> >Thanks in advance,
> >
> >Mike Smith
> >
> >P.S. - Here's my javascript code that automatically loads/unloads layers:
> >
> >function UpdateMap() {
> >    document.mapserv.submit();   //Note that my form name is "mapserv"
> >}
> >
> >Then I add this to my checkbox tag:
> >
> >onClick="UpdateMap();"
> >
> >
>
>
>
> **********************************************************************
> The information contained in this email and any subsequent
> correspondence is private and is intended solely for the
> intended recipient(s). For those other than the intended
> recipient(s) any disclosure, copying, distribution, or any
> action taken or omitted to be taken in reliance on such
> information is prohibited and may be unlawful.
> **********************************************************************


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20020911/0d6c9134/attachment.html


More information about the mapserver-users mailing list