goog.require('ol.Attribution'); goog.require('ol.Map'); goog.require('ol.RendererHints'); goog.require('ol.View2D'); goog.require('ol.layer.Image'); goog.require('ol.proj'); goog.require('ol.source.ImageWMS'); var projection = ol.proj.configureProj4jsProjection({ code: 'EPSG:21781', extent: [485869.5728, 76443.1884, 837076.5648, 299941.7864] }); var extent = [420000, 30000, 900000, 350000]; var layers = [ new ol.layer.Image({ source: new ol.source.ImageWMS({ url: 'http://wms.geo.admin.ch/', crossOrigin: 'anonymous', attributions: [new ol.Attribution({ html: '© ' + '' + 'Pixelmap 1:1000000 / geo.admin.ch' })], params: { 'LAYERS': 'ch.swisstopo.pixelkarte-farbe-pk1000.noscale', 'FORMAT': 'image/jpeg' }, extent: extent }) }), new ol.layer.Image({ source: new ol.source.ImageWMS({ url: 'http://wms.geo.admin.ch/', crossOrigin: 'anonymous', attributions: [new ol.Attribution({ html: '© ' + '' + 'National parks / geo.admin.ch' })], params: {'LAYERS': 'ch.bafu.schutzgebiete-paerke_nationaler_bedeutung'}, extent: extent }) }) ]; var map = new ol.Map({ layers: layers, renderers: ol.RendererHints.createFromQueryData(), target: 'map', view: new ol.View2D({ projection: projection, center: [660000, 190000], zoom: 2 }) });