[OpenLayers-Commits] r12107 - trunk/openlayers/examples
commits-20090109 at openlayers.org
commits-20090109 at openlayers.org
Sat Jun 18 15:27:28 EDT 2011
Author: ahocevar
Date: 2011-06-18 12:27:27 -0700 (Sat, 18 Jun 2011)
New Revision: 12107
Added:
trunk/openlayers/examples/bing-tiles-restrictedzoom.html
trunk/openlayers/examples/bing-tiles-restrictedzoom.js
Log:
removing the restrictedMinZoom property, and allow for restricting zoom levels with maxResolution and numZoomLevels. Thanks tschaub for the doc, test and examples improvements. r=tschaub (see #3338)
Added: trunk/openlayers/examples/bing-tiles-restrictedzoom.html
===================================================================
--- trunk/openlayers/examples/bing-tiles-restrictedzoom.html (rev 0)
+++ trunk/openlayers/examples/bing-tiles-restrictedzoom.html 2011-06-18 19:27:27 UTC (rev 12107)
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
+ <meta name="apple-mobile-web-app-capable" content="yes">
+ <title>Basic Bing Tiles with a Subset of Resolutions Example</title>
+ <link rel="stylesheet" href="../theme/default/style.css" type="text/css">
+ <link rel="stylesheet" href="style.css" type="text/css">
+ <style type="text/css">
+ .olControlAttribution {
+ left: 2px;
+ right: inherit;
+ bottom: 3px;
+ line-height: 11px;
+ }
+ </style>
+ </head>
+ <body>
+ <h1 id="title">Bing Tiles with a Subset of Resolutions Example</h1>
+
+ <div id="tags">
+ bing tiles restrictedMinZoom numZoomLevels
+ </div>
+
+ <div id="shortdesc">Use Bing with direct tile access</div>
+
+ <div id="map" class="smallmap" style="height: 350px;"></div>
+
+ <div id="docs">
+ <p>
+ This example shows how to use the <code>maxResolution</code> and
+ <code>numZoomLevels</code> layer properties to restrict
+ the number of zoom levels displayed on the Bing layer.
+ </p><p>
+ See <a target="_blank" href="bing-tiles-restrictedzoom.js">bing-tiles-restrictedzoom.js</a>
+ for the source code.
+ </p>
+ </div>
+ <script src="../lib/OpenLayers.js"></script>
+ <script src="bing-tiles-restrictedzoom.js"></script>
+ </body>
+</html>
Added: trunk/openlayers/examples/bing-tiles-restrictedzoom.js
===================================================================
--- trunk/openlayers/examples/bing-tiles-restrictedzoom.js (rev 0)
+++ trunk/openlayers/examples/bing-tiles-restrictedzoom.js 2011-06-18 19:27:27 UTC (rev 12107)
@@ -0,0 +1,37 @@
+// API key for http://openlayers.org. Please get your own at
+// http://bingmapsportal.com/ and use that instead.
+var apiKey = "AqTGBsziZHIJYYxgivLBf0hVdrAk9mWO5cQcb8Yux8sW5M8c8opEC2lZqKR1ZZXf";
+
+var map = new OpenLayers.Map('map', {
+ controls: [
+ new OpenLayers.Control.Attribution(),
+ new OpenLayers.Control.Navigation(),
+ new OpenLayers.Control.PanZoomBar(),
+ new OpenLayers.Control.LayerSwitcher()
+ ]
+});
+
+var road3 = new OpenLayers.Layer.Bing({
+ name: "Road tiles with 3 zoom levels",
+ type: "Road",
+ key: apiKey,
+ maxResolution: 76.43702827453613,
+ numZoomLevels: 3
+});
+var road5 = new OpenLayers.Layer.Bing({
+ name: "Road tiles with 5 zoom levels",
+ type: "Road",
+ key: apiKey,
+ numZoomLevels: 5
+});
+var road = new OpenLayers.Layer.Bing({
+ name: "Road tiles with all zoom levels",
+ type: "Road",
+ key: apiKey
+});
+
+map.addLayers([road3, road5, road]);
+map.setCenter(new OpenLayers.LonLat(-71.147, 42.472).transform(
+ new OpenLayers.Projection("EPSG:4326"),
+ map.getProjectionObject()
+), 1);
More information about the Commits
mailing list