我不明白为什么"归因"不会出现在图层中。
你有个主意吗?
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',
})
});
答案 0 :(得分:2)
attributions
是a 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)"
})],
})
});