From 7d477fb8afb465fa63abdd5ce0add35516bee694 Mon Sep 17 00:00:00 2001 From: ahocevar Date: Sat, 18 Jun 2011 19:27:27 +0000 Subject: [PATCH] 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) git-svn-id: http://svn.openlayers.org/trunk/openlayers@12107 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- examples/bing-tiles-restrictedzoom.html | 43 +++++++++++++++++++++++++ examples/bing-tiles-restrictedzoom.js | 37 +++++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 examples/bing-tiles-restrictedzoom.html create mode 100644 examples/bing-tiles-restrictedzoom.js diff --git a/examples/bing-tiles-restrictedzoom.html b/examples/bing-tiles-restrictedzoom.html new file mode 100644 index 0000000000..992bd143ab --- /dev/null +++ b/examples/bing-tiles-restrictedzoom.html @@ -0,0 +1,43 @@ + + + + + + + Basic Bing Tiles with a Subset of Resolutions Example + + + + + +

Bing Tiles with a Subset of Resolutions Example

+ +
+ bing tiles restrictedMinZoom numZoomLevels +
+ +
Use Bing with direct tile access
+ +
+ +
+

+ This example shows how to use the maxResolution and + numZoomLevels layer properties to restrict + the number of zoom levels displayed on the Bing layer. +

+ See bing-tiles-restrictedzoom.js + for the source code. +

+
+ + + + diff --git a/examples/bing-tiles-restrictedzoom.js b/examples/bing-tiles-restrictedzoom.js new file mode 100644 index 0000000000..45c226fba6 --- /dev/null +++ b/examples/bing-tiles-restrictedzoom.js @@ -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);