Skip to content

OpenLayers

Jonathan Beliën edited this page Dec 11, 2018 · 13 revisions

Example

Click here to see it working.

Code

var attribution = new ol.control.Attribution({
  collapsible: false
});
var map = new ol.Map({
  controls: ol.control.defaults({attribution: false}).extend([attribution]),
  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>" ],
        maxZoom: 18
      })
    })
  ],
  target: "map",
  view: new ol.View({
    center: [0, 0],
    maxZoom: 18,
    zoom: 2
  })
});

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