Updating example to match @ahocevar's mobile-wmts-vienna branch

This commit is contained in:
ahocevar
2013-02-14 10:44:41 +01:00
parent 4b163e0482
commit e9b65691c4
+32 -21
View File
@@ -96,20 +96,14 @@ var map;
theme: null, theme: null,
projection: "EPSG:3857", projection: "EPSG:3857",
units: "m", units: "m",
maxExtent: [-20037508.34, -20037508.34, 20037508.34, 20037508.34], restrictedExtent: [1799448.394855, 6124949.747770, 1848250.442089, 6162571.828177],
maxResolution: 156543.0339, maxResolution: 38.21851413574219,
numZoomLevels: 20, numZoomLevels: 8,
tileManager: new OpenLayers.TileManager(), tileManager: new OpenLayers.TileManager(),
controls: [ controls: [
new OpenLayers.Control.Navigation({ new OpenLayers.Control.Navigation({
mouseWheelOptions: {
cumulative: false,
interval: 20
},
dragPanOptions: { dragPanOptions: {
enableKinetic: { enableKinetic: true
deceleration: 0.02
}
}, },
zoomBoxEnabled: false zoomBoxEnabled: false
}), }),
@@ -133,9 +127,11 @@ var map;
// Defaults for the WMTS layers // Defaults for the WMTS layers
var defaults = { var defaults = {
zoomOffset: 12,
requestEncoding: "REST", requestEncoding: "REST",
matrixSet: "google3857", matrixSet: "google3857",
attribution: 'Datenquelle: Stadt Wien - <a href="http://data.wien.gv.at">data.wien.gv.at</a>' attribution: 'Datenquelle: Stadt Wien - <a href="http://data.wien.gv.at">data.wien.gv.at</a>',
transitionEffect: "resize"
}; };
// The WMTS layers we're going to add // The WMTS layers we're going to add
@@ -160,10 +156,10 @@ var map;
var doc = request.responseText, var doc = request.responseText,
caps = format.read(doc); caps = format.read(doc);
fmzk = format.createLayer(caps, OpenLayers.Util.applyDefaults( fmzk = format.createLayer(caps, OpenLayers.Util.applyDefaults(
{layer:"fmzk", transitionEffect:"resize"}, defaults {layer:"fmzk"}, defaults
)); ));
aerial = format.createLayer(caps, OpenLayers.Util.applyDefaults( aerial = format.createLayer(caps, OpenLayers.Util.applyDefaults(
{layer:"lb", transitionEffect:"resize"}, defaults {layer:"lb"}, defaults
)); ));
labels = format.createLayer(caps, OpenLayers.Util.applyDefaults( labels = format.createLayer(caps, OpenLayers.Util.applyDefaults(
{layer:"beschriftung", isBaseLayer: false}, {layer:"beschriftung", isBaseLayer: false},
@@ -182,24 +178,39 @@ var map;
var extent = new OpenLayers.Bounds(1799448.394855, 6124949.74777, 1848250.442089, 6162571.828177); var extent = new OpenLayers.Bounds(1799448.394855, 6124949.74777, 1848250.442089, 6162571.828177);
defaults.tileFullExtent = extent; defaults.tileFullExtent = extent;
fmzk = new OpenLayers.Layer.WMTS(OpenLayers.Util.applyDefaults({ fmzk = new OpenLayers.Layer.WMTS(OpenLayers.Util.applyDefaults({
url: "http://maps.wien.gv.at/wmts/fmzk/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpeg", url: [
"http://maps.wien.gv.at/wmts/fmzk/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpeg",
"http://maps1.wien.gv.at/wmts/fmzk/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpeg",
"http://maps2.wien.gv.at/wmts/fmzk/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpeg",
"http://maps3.wien.gv.at/wmts/fmzk/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpeg",
"http://maps4.wien.gv.at/wmts/fmzk/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpeg"
],
layer: "fmzk", layer: "fmzk",
style: "pastell", style: "pastell"
transitionEffect: "resize"
}, },
defaults)); defaults));
aerial = new OpenLayers.Layer.WMTS(OpenLayers.Util.applyDefaults({ aerial = new OpenLayers.Layer.WMTS(OpenLayers.Util.applyDefaults({
url: "http://maps.wien.gv.at/wmts/lb/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpeg", url: [
"http://maps.wien.gv.at/wmts/lb/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpeg",
"http://maps1.wien.gv.at/wmts/lb/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpeg",
"http://maps2.wien.gv.at/wmts/lb/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpeg",
"http://maps3.wien.gv.at/wmts/lb/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpeg",
"http://maps4.wien.gv.at/wmts/lb/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpeg"
],
layer: "lb", layer: "lb",
style: "farbe", style: "farbe"
transitionEffect: "resize"
}, },
defaults)); defaults));
labels = new OpenLayers.Layer.WMTS(OpenLayers.Util.applyDefaults({ labels = new OpenLayers.Layer.WMTS(OpenLayers.Util.applyDefaults({
url: "http://maps.wien.gv.at/wmts/beschriftung/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.png", url: [
"http://maps.wien.gv.at/wmts/beschriftung/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.png",
"http://maps1.wien.gv.at/wmts/beschriftung/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.png",
"http://maps2.wien.gv.at/wmts/beschriftung/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.png",
"http://maps3.wien.gv.at/wmts/beschriftung/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.png",
"http://maps4.wien.gv.at/wmts/beschriftung/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.png"
],
layer: "beschriftung", layer: "beschriftung",
style: "normal", style: "normal",
transitionEffect: null,
isBaseLayer: false isBaseLayer: false
}, },
defaults)); defaults));