[mapserver-users] Pre-defined Zoom In/Zoom Out buttons...

Mike Smith nospam at cnrit.tamu.edu
Fri Sep 27 14:46:46 EDT 2002


I could easily implement a new variable like your "zoomLevel"...I was 
already thinking that I needed to do that.  And I've got a series of 
little buttons next to my map that make up a zoom bar like yours, and 
each button (when clicked) makes a call to a javascript function that 
I've written called "zoomTo".  So I've got the framework there, I just 
can't figure out how to set my imgext based on this zoomLevel factor 
(relative to my map's maximum extent, not the current zoom level).  I'd 
like to do just what you're doing on your page and have each zoom button 
present the same imgext and zoom level each time...right now I'm just 
incrementing the Mapserver variable "zoom" and "zoomsize" and the 
buttons build on the last zoom, instead of always zooming to a set 
factor relative to max extent.  I don't want to ask you for your 
proprietary source code, but can you shed any light on what kind of 
algorithm I might use to determine the new imgext as a function of max 
extent and zoomLevel?

Also, as Puneet pointed out, I will not be overriding the mouse click 
coordinates with this zoom level, so that the zooming will happen 
relative to whatever image center the user has already clicked on, and 
if they haven't clicked anywhere then I'll zoom straight into the 
centerpoint of my main map.

Thanks!



Joe Bussell wrote:

>www.TrafficDodger.com has just such a zoom bar.  I view it like fliing
>at different altitudes.  The higher you go, the more area you see and
>you see less detail.  I use a zoomLevel variable in my javascript.  Each
>button triggers a call to zoomToLevel with its own arguments.  Regular
>zoomIn and zoomOut increment and decrement this value.  I then determine
>the extent based on some function of the zoomLevel and my full scale
>range.
>
>Cordially,
>
>Joe Bussell
>On Time Systems
>www.TrafficDodger.com
>
>
>
>On Fri, Sep 27, 2002 at 09:45:06AM -0500, Mike Smith wrote:
>
>>Sorry to bother everyone with this, I know this has been addressed 
>>before in the archives, but I can't seem to find it when I search them.
>>
>>I'm trying to enable a Zoom In/Zoom Out bar along side my map (kinda 
>>like Mapquest or Yahoo maps) where there are buttons that either zoom 
>>the user in or out to pre-determined levels.  I've got Javascript code 
>>that zooms in and out ok, but the logic is what's throwing me off.  I 
>>want the bottom button to always be the same view, not zoom them out 15 
>>times from whatever their present view is.... it should zoom them out 15 
>>times from full extent.  I want "full extent" to be the base and each 
>>button whether it's a zoom in or out button needs to always zoom them to 
>>the same factor relative to full extent, not their current view...make 
>>sense?  I know I've seen a Mapserver page before that had this little 
>>zoom bar that I'm describing, but I can't remember where I saw it. 
>>Anybody have a web page that does this?  Or example code that handles 
>>the logic of pre-defined absolute zoom levels (as opposed to the 
>>relative ones that the CGI variable "zoom" sets)?
>>
>>Thanks
>>
>>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20020927/05720db8/attachment.html


More information about the mapserver-users mailing list