Openlayers 4.6.4,无法使用 source.getAttributions() 获取 BingMap 属性
Openlayers 4.6.4, Can't get BingMap attributions using source.getAttributions()
我们在应用程序中使用 BingMap 并调用 source.getAttributions() 在 pdf 上打印 bing 属性。
升级到OL4.6.4后,source.getattributions() return null。
Post https://github.com/openlayers/openlayers/pull/7329 解释了为什么 bing 地图的 getattributions() return 为 null。
是否有任何解决方法来获取代码中的 Bing 属性?
这将在 v5.0 中再次工作,但是您从 getAttributions()
获得的将是一个您使用 FrameState
调用的函数。像
var getAttribution = bingSource().getAttributions();
var attribution = getAttribution({
extent: map.getView().calculateExtent(),
viewState: map.getView().getState()
});
或者在地图的 'postcompose' 或 'postrender' 事件的侦听器中更容易:
var getAttribution = bingSource().getAttributions();
map.on('postcompose', function(e) {
var attribution = getAttribution(e.frameState);
});
我们在应用程序中使用 BingMap 并调用 source.getAttributions() 在 pdf 上打印 bing 属性。 升级到OL4.6.4后,source.getattributions() return null。 Post https://github.com/openlayers/openlayers/pull/7329 解释了为什么 bing 地图的 getattributions() return 为 null。
是否有任何解决方法来获取代码中的 Bing 属性?
这将在 v5.0 中再次工作,但是您从 getAttributions()
获得的将是一个您使用 FrameState
调用的函数。像
var getAttribution = bingSource().getAttributions();
var attribution = getAttribution({
extent: map.getView().calculateExtent(),
viewState: map.getView().getState()
});
或者在地图的 'postcompose' 或 'postrender' 事件的侦听器中更容易:
var getAttribution = bingSource().getAttributions();
map.on('postcompose', function(e) {
var attribution = getAttribution(e.frameState);
});