From bb957a1149819f6819b390ee6aa62b85ea72e07f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Moullet?= Date: Sun, 28 Oct 2012 04:54:03 +0100 Subject: [PATCH] Add new layer national park, attributions and layer extent to the Tiled WMS with custom projection example --- examples/wms-custom-proj.html | 4 ++-- examples/wms-custom-proj.js | 19 ++++++++++++++++--- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/examples/wms-custom-proj.html b/examples/wms-custom-proj.html index 8dc04d889d..0638842076 100644 --- a/examples/wms-custom-proj.html +++ b/examples/wms-custom-proj.html @@ -33,10 +33,10 @@

Tiled WMS with custom projection example

-
Example of a tiled WMS layer using the projection EPSG:21781.
+
Example of two tiled WMS layers (Pixelmap 1:1'000'000 and national parks) using the projection EPSG:21781.

See the - wms-custom-proj.js source + wms-custom-proj.js source to see how this is done.

diff --git a/examples/wms-custom-proj.js b/examples/wms-custom-proj.js index ee262faec5..270b1423e9 100644 --- a/examples/wms-custom-proj.js +++ b/examples/wms-custom-proj.js @@ -24,16 +24,29 @@ var layers = new ol.Collection([ new ol.layer.TileLayer({ source: new ol.source.TiledWMS({ url: 'http://wms.geo.admin.ch/?', + attributions: [new ol.Attribution('© Pixelmap 1:1000000 / geo.admin.ch')], + crossOrigin: null, params: {'LAYERS': 'ch.swisstopo.pixelkarte-farbe-pk1000.noscale'}, - projection: epsg21781 + projection: epsg21781, + extent: extent + }) + }), + new ol.layer.TileLayer({ + source: new ol.source.TiledWMS({ + url: 'http://wms.geo.admin.ch/?', + attributions: [new ol.Attribution('© National parks / geo.admin.ch')], + crossOrigin: null, + params: {'LAYERS': 'ch.bafu.schutzgebiete-paerke_nationaler_bedeutung'}, + projection: epsg21781, + extent: extent }) }) ]); var map = new ol.Map({ - center: new ol.Coordinate(600000, 200000), + center: new ol.Coordinate(660000, 190000), projection: epsg21781, layers: layers, target: 'map', - zoom: 8 + zoom: 9 });