[OpenLayers-Users] Two Google layers with specified max and min
zoom levels
Tara Athan
tara_athan at alt2is.com
Tue Apr 8 00:32:20 EDT 2008
I am trying to get the following simple map to work so that the user can
zoom in to the maximum level available for each layer, and when
switching between the two base layers there are not any jumps in the
zoom level. I see several posts in the forum about this issue, but none
seem to have the complete solution. This would make a great example map
to add to your list, if someone could help get this working.
Thanks, Tara
<head>
<link rel="stylesheet"
href="http://www.openlayers.org/dev/theme/default/style.css"
type="text/css" />
<script
src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAIy8lG8k0bDNp_2oCuJP6GRRgIxCI1T7LqjqwJd5RhaiEwpop1hQHuLRkRnN_y0SSf_z_sWCnmf3v1w"
type="text/javascript"></script>
<script src="http://openlayers.org/api/OpenLayers.js"
type="text/javascript"></script>
</head>
<body>
<div id="map" ></div>
<script defer="defer" type="text/javascript">
<!--
var map, layer;
var lon, lat, zoom;
map = new OpenLayers.Map( 'map', {controls: [new
OpenLayers.Control.PanZoomBar()], 'numZoomLevels':15} );
map.addControl(new OpenLayers.Control.LayerSwitcher());
var google = new OpenLayers.Layer.Google("Google Streets",
{MIN_ZOOM_LEVEL:9, MAX_ZOOM_LEVEL:23});
var googleh = new OpenLayers.Layer.Google("Google Hybrid", {
'type': G_HYBRID_MAP, MIN_ZOOM_LEVEL:9, MAX_ZOOM_LEVEL:23 });
map.addLayers([google, googleh]);
lon = -123;
lat = 39.5;
zoom = 0;
map.setCenter(new OpenLayers.LonLat(lon,lat), zoom);
-->
</script>
</body>
More information about the Users
mailing list