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