Adding a zoomOffset property to XYZ and TMS layers. This allows you to have a map with a maximum resolution that differs from the maximum cache resolution (if you want to show a subset of OSM for example). r=ahocevar (closes #2616)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@10650 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Tim Schaub
2010-08-20 19:40:53 +00:00
parent 5750b5f6e0
commit 59953b8eb6
6 changed files with 192 additions and 2 deletions

37
examples/xyz-offset.js Normal file
View File

@@ -0,0 +1,37 @@
var map, layer;
// if tiles are not available, hide images
//OpenLayers.Util.onImageLoadError = function() {
// this.style.display = "none";
//}
// called on body load
function init() {
var extent = new OpenLayers.Bounds(
-13758743.4295939, 5591455.28887228, -13531302.3472101 , 5757360.4178881
);
map = new OpenLayers.Map({
div: "map",
maxExtent: new OpenLayers.Bounds(
-128 * 156543.0339, -128 * 156543.0339,
128 * 156543.0339, 128 * 156543.0339
),
restrictedExtent: extent,
maxResolution: 611.496226171875, // corresponds to level 8 in the cache
numZoomLevels: 6,
projection: new OpenLayers.Projection("EPSG:900913"),
units: "m",
layers: [
new OpenLayers.Layer.XYZ(
"ESRI",
"http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Portland/ESRI_LandBase_WebMercator/MapServer/tile/${z}/${y}/${x}",
{zoomOffset: 8} // since our map maxResolution differs from cache max resolution
)
]
});
map.zoomToExtent(extent);
}