[fusion-users] min/max Zoom scales
Måns Beckman
mans.beckman at manandmachine.se
Wed May 21 06:41:41 EDT 2008
Hi All,
First I'm just going to tell you that I'm not really a programmer, I'm more of a script kiddie, so bare with me.
The thing is that we got a customer that wants to limit how close the user can zoom in to the map. So I started to have a look and found out that there was something that made the map not zoom in closer than the scale 1:1. So I started do look in the code for what was preventing this, but I didn't find anything in the zoom widgets or in the zoom functions in Map.js. So I started to think there was something in openlayers that made it impossible to zoom in more.
Ok, so eventually I found out that we can send some options when we initialize the open layers map, and I guess that 1:1 is the default value. http://trac.openlayers.org/wiki/SettingZoomLevels
So I looked in the code for where we initialize an open layer map and found something on line 98 (this is MGE2009 so the exact lines might have changed). Anyway I thought that I would try to send some more options to the map and changed line 94 from
var options = {controls: [], fallThrough: true};
to
var options = {controls: [], fallThrough: true, minScale: 10000};
When I reload my map it initializes on scale 1:10000, I can zoom in but not out. I try to change minScale to maxScale, to make the opposite happen. But when I do that, nothing happens in the map, it works like I had sent no extra option at all.
So, could someone explain this behavior? And could someone tell me how to solve my problem without using fixed zoomscales?
Best regards
Måns
-----------------------------------------------------------
Måns Beckman
Man and Machine
Fabriksgatan 13
412 50 Göteborg
Phone: +46 31 - 762 8182
Mobile: +46 733 - 38 83 19
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/fusion-users/attachments/20080521/3869aa08/attachment.html
More information about the fusion-users
mailing list