[OpenLayers-Users] How to understand and use zoom levels?
Zhanna Maher
zhanna at planetzhanna.com
Sun Dec 23 09:34:05 EST 2007
Hello,
I must be missing something simple. My function is as follows:
function init(lon,lat,zoom){
var map = new OpenLayers.Map('inter_map', { controls: [] });
map.addControl(new
OpenLayers.Control.LayerSwitcher({activeColor:'green'}));
map.addControl(new OpenLayers.Control.PanZoomBar());
map.addControl(new OpenLayers.Control.MouseDefaults());
var layer_drg = new OpenLayers.Layer.WMS( "USGS Topo",
"http://terraservice.net/ogcmap.ashx", {layers: 'drg'},
{numZoomLevels: 5}, {'buffer':1});
var layer_doq = new OpenLayers.Layer.WMS( "USGS Aerial",
"http://terraservice.net/ogcmap.ashx", {layers: 'doq' },
{'buffer':1} );
var yahoo = new OpenLayers.Layer.Yahoo( "Yahoo" );
map.addLayers([layer_drg,layer_doq,yahoo]);
map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
var markersLayer = new OpenLayers.Layer.Markers("Survey mark" );
var marker = new OpenLayers.Marker(
new OpenLayers.LonLat(lon,lat),
new OpenLayers.Icon(
"graphics/benchmark_icon.gif",
new OpenLayers.Size(11,11)
));
markersLayer.addMarker(marker);
map.addLayer(markersLayer);
}
I'm trying to restrict the zoom levels on the DRG layer to 5; I want to only
be able to view levels 11-15. I would like the map to load at zoom level
15. But no matter what options I use (numZoomLevels, maxZoomLevel, etc.) I
cannot get the proper behavior. I am assuming this is considered a 3rd
party later like Google and as such has pre-set resolutions, but maybe this
isn't the case. Does anyone have an idea? I can provide a live example if
necessary.
Thanks,
Zhanna
-----Original Message-----
From: Eric Lemoine [mailto:eric.c2c at gmail.com]
Sent: Wednesday, December 19, 2007 2:37 PM
To: Zhanna Maher
Cc: users at openlayers.org
Subject: Re: [OpenLayers-Users] How to understand and use zoom levels?
[...]
This wiki page explains how to use scales/resolutions/etc. in OpenLayers.
<http://trac.openlayers.org/wiki/SettingZoomLevels>.
You can also check this example:
<http://www.openlayers.org/dev/examples/zoomLevels.html>.
[...]
--
Eric
More information about the Users
mailing list