图层归因不会出现

时间:2015-12-26 13:22:00

标签: openlayers-3

我不明白为什么"归因"不会出现在图层中。

你有个主意吗?

   var raster = new ol.layer.Tile({
        title: 'OSM',
        type: 'base',
        minResolution : 2,
        attributions: [new ol.Attribution({
        html: "© OpenStreetMap -Mitwirkende, SRTM | Affichage de la carte: © OpenTopoMap (CC-BY-SA)"
        })],
        source: new ol.source.XYZ({
        url: '//{a-c}.tile.opentopomap.org/{z}/{x}/{y}.png',
    })
});

1 个答案:

答案 0 :(得分:2)

attributionsa property of the source property of a layer

这意味着您的图层定义应如下所示:

var raster = new ol.layer.Tile({
  title: 'OSM',
  type: 'base',
  minResolution : 2,
  source: new ol.source.XYZ({
    url: '//{a-c}.tile.opentopomap.org/{z}/{x}/{y}.png',
    attributions: [new ol.Attribution({
      html: "© OpenStreetMap -Mitwirkende, SRTM | Affichage de la carte: © OpenTopoMap (CC-BY-SA)"
    })],
  })
});