Skip to content

OpenLayers

Jonathan Beliën edited this page Oct 6, 2017 · 13 revisions
var attribution = new ol.control.Attribution({
  collapsible: false
});
var map = new ol.Map({
  layers: [
    new ol.layer.Tile({
      source: new ol.source.OSM({
        url: "https://tile.openstreetmap.be/osmbe/{z}/{x}/{y}.png",
        attributions: [ ol.source.OSM.ATTRIBUTION, "Tiles courtesy of <a href=\"https://geo6.be/\">GEO-6</a>" ]
      })
    })
  ],
  controls: ol.control.defaults({attribution: false}).extend([attribution]),
  target: "map",
  view: new ol.View({
    center: [0, 0],
    zoom: 2
  })
});

Just replace osmbe by osmbe-fr, osmbe-nl or osmbe-de to render localized baselayer.