[mapserver-users] zoom box in JavaScript (not Java)

Hockaday John John.Hockaday at ga.gov.au
Sun Sep 29 19:52:45 EDT 2002


Hi Brent,

I think that I have something like what you are asking for.  Please look at the URL 

http://www.auslig.gov.au/servlet/asdd_power

and click on the image of Australia.  This will pop up in another window a simple mapserver implementation.  You can drag a box on the map image and this will cause mapserver to roughly zoom into the dragged box area.  Note that a blue box indicates the actual dragged box area and the map is a fixed image size of 300 by 300 pixels.  That is why I say "roughly".

The JavaScript code is a bit slapped together for this interface but if you use it I would greatly appreciate it if you would send me the tidied up/optimised version of the JavaScript.  I intended on looking into importing the zoom box JavaScript code from a file that can be used by many interfaces but of course I haven't got around to that yet.  (Prototypes always seem to just stay prototypes)  ;--)

I hope that this helps.

John

> -----Original Message-----
> From: Andrew Haigh [mailto:lists.ahaigh at dsl.pipex.com]
> Sent: Monday, 30 September 2002 4:17 
> Cc: Dan Barron; MapServer Mailing List
> Subject: Re: [mapserver-users] zoom box in JavaScript (not Java)
> 
> 
> I'm not sure if this will work or not but try something this:
> 
> 1. Place the map image tag in a <div id="mapdiv" etc>. (Make the dive
> the same size as the image)
> 2. Modify the ESRI code, so it doesn't use frames (although 
> it might be
> easier to rewrite it -  I think).
> 3. Get the user to draw the drag box, when the user has 
> finished, you've
> got the mouse start and end co-ordinates.
> 4. Get the location of the div "mapdiv" using the getElementByID
> javascript function, to get a handle on the div and then read 
> its X and
> Y values.
> 
> I'll give it a try, when I get a chance.
> 
> Let me know how you get on if you try it.
> 
> This code will only work for IE6+ and NN6+ (I think) although 
> I've lost
> my JavaScript book!
> 
> Andrew
> 
> On Sun, 2002-09-29 at 16:34, Alex Rice wrote:
> > 
> > On Saturday, September 28, 2002, at 03:37  PM, Dan Barron wrote:
> > 
> > > The javascript to do this is really pretty straight 
> forward.  In a 
> > > nutshell this is all you should need to know.
> > >
> > 
> > This is something different- I think the question was about 
> how to draw 
> > a zoombox, also called "rubber band" box. Where you click 
> and drag to 
> > create the new extent you want to zoom to.
> > 
> > 
> > Alex Rice, Software Developer
> > Architectural Research Consultants, Inc.
> > alrice at swcp.com
> > alex_rice at arc.to
> > 
> -- 
> -- 
> 
> "Imagination is more important than knowledge."
> 
> 



More information about the mapserver-users mailing list