1 | goog.require('ol.Map');
|
2 | goog.require('ol.View');
|
3 | goog.require('ol.layer.Image');
|
4 | goog.require('ol.layer.Tile');
|
5 | goog.require('ol.proj.Projection');
|
6 | goog.require('ol.source.ImageWMS');
|
7 | goog.require('ol.source.TileWMS');
|
8 |
|
9 |
|
10 | var layers = [
|
11 | new ol.layer.Tile({
|
12 | source: new ol.source.TileWMS({
|
13 | attributions: '© <a href="http://www.geo.admin.ch/internet/geoportal/' +
|
14 | 'en/home.html">Pixelmap 1:1000000 / geo.admin.ch</a>',
|
15 | crossOrigin: 'anonymous',
|
16 | params: {
|
17 | 'LAYERS': 'ch.swisstopo.pixelkarte-farbe-pk1000.noscale',
|
18 | 'FORMAT': 'image/jpeg'
|
19 | },
|
20 | url: 'https://wms.geo.admin.ch/'
|
21 | })
|
22 | }),
|
23 | new ol.layer.Image({
|
24 | source: new ol.source.ImageWMS({
|
25 | attributions: '© <a href="http://www.geo.admin.ch/internet/geoportal/' +
|
26 | 'en/home.html">National parks / geo.admin.ch</a>',
|
27 | crossOrigin: 'anonymous',
|
28 | params: {'LAYERS': 'ch.bafu.schutzgebiete-paerke_nationaler_bedeutung'},
|
29 | serverType: 'mapserver',
|
30 | url: 'https://wms.geo.admin.ch/'
|
31 | })
|
32 | })
|
33 | ];
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 | var projection = new ol.proj.Projection({
|
41 | code: 'EPSG:21781',
|
42 | units: 'm'
|
43 | });
|
44 |
|
45 | var map = new ol.Map({
|
46 | layers: layers,
|
47 | target: 'map',
|
48 | view: new ol.View({
|
49 | center: [660000, 190000],
|
50 | projection: projection,
|
51 | zoom: 9
|
52 | })
|
53 | });
|