I'm implementing a baselayer to be used by a Plone addon (collective.geo.openlayers). My implementation specifically creates a layer and returns it to the addon, which enables many different layers to be configured through a webinterface.
I got it working well, but there is one problem I'm facing that I cannot wrap my head around.
The map displayed is a small local map which only shows tiles when zoomed in to zoom level 11 and higher. For this reason I would like to limit the user from zooming out farther than that.
But when I try to add maxZoomLevel, minZoomLevel or numZoomLevels to the layer definition I get type errors in the getTileInfo function because Openlayers is trying to access the longitude of the tileOrigin property which for some reason is null.
I tried different suggestions about limiting the zoom level but to no avail.
Does anyone know how to limit the zoom levels in the following layer definition?
I cannot simply work around the issue by doing something to the map instance itself, as I only control the layer creation.
function() {
var zugmap_matrixids = [{
identifier : 0,
topLeftCorner : new OpenLayers.LonLat(919690.324327, 5987771.047746)
}, {
identifier : 1,
topLeftCorner : new OpenLayers.LonLat(929474.2639475, 5987771.047746)
}, {
identifier : 2,
topLeftCorner : new OpenLayers.LonLat(929474.2639456, 5987771.04773376)
}, {
identifier : 3,
topLeftCorner : new OpenLayers.LonLat(931920.24885072, 5985325.06282864)
}, {
identifier : 4,
topLeftCorner : new OpenLayers.LonLat(931920.24885072, 5984102.07037608)
}, {
identifier : 5,
topLeftCorner : new OpenLayers.LonLat(932531.745078525, 5983490.57415958)
}, {
identifier : 6,
topLeftCorner : new OpenLayers.LonLat(932837.49319014, 5983184.82603666)
}, {
identifier : 7,
topLeftCorner : new OpenLayers.LonLat(932990.36724671, 5983031.95198009)
}
];
var layer = new OpenLayers.Layer.WMTS({
name : "LuftbildPlus+",
url : [
"http://webdienste.zugmap.ch/OrthofotoPlus_tiled/service.svc/get"
],
layer : "LuftbildPlusGoogle",
matrixSet : "LuftbildPlusGoogle",
matrixIds : zugmap_matrixids,
tileFullExtent : new OpenLayers.Bounds(919690.324327, 5948635.289264, 978393.96205, 5987771.047746),
maxExtent : new OpenLayers.Bounds(919690.324327, 5948635.289264, 978393, 5987771),
style : "default",
format : "image/png",
isBaseLayer : true,
zoomOffset : -11,
//numZoomLevels: 8
});
return layer
}
You'll notice that numZoomLevels is commented out. I feel like this should be the correct property to set as the matrices only contain 8 levels, but if I uncomment it, I get the type error I was talking about. If I don't use numZoomLevels or any other property that controls the zoom the map works fine.