为什么OpenLayers Bing层在低/高缩放级别消失?

时间:2015-03-04 23:27:58

标签: zoom openlayers bing-maps

我注意到OpenLayers的Bing层在低(0)和高(20)缩放级别消失。我怎么能避免它?是否有可能对缩放级别施加一些限制?

var apiKey = "AqTGBsziZHIJYYxgivLBf0hVdrAk9mWO5cQcb8Yux8sW5M8c8opEC2lZqKR1ZZXf";
var map;

map = new OpenLayers.Map('map', {
    allOverlays: false,
    autoUpdateSize: true,
    displayProjection: new OpenLayers.Projection('EPSG:4326'),
    numZoomLevels: 16,
    projection: new OpenLayers.Projection('EPSG:900913'),
    zoomMethod: null,
    units: 'km'
});

map.addControl(new OpenLayers.Control.LayerSwitcher());

var osm = new OpenLayers.Layer.OSM();
var bing = new OpenLayers.Layer.Bing({
    name: "Road",
    key: apiKey,
    type: "Road"
});

map.addLayer(osm);
map.addLayer(bing);

var center = new OpenLayers.LonLat(-0.125, 51.5);
center.transform(new OpenLayers.Projection('EPSG:4326'), new OpenLayers.Projection('EPSG:900913'));
var zoomLevel = 4;
map.setCenter(center, zoomLevel);

$('#zoomLevel').html(zoomLevel);
map.events.register('zoomend', map, function() {
    $('#zoomLevel').html(this.zoom);
});

这是我的codepen,您可以测试,OSM层不会发生此行为。请帮我解决这个问题。

由于

1 个答案:

答案 0 :(得分:1)

Bing地图地图图块仅在缩放级别1 - 19可用。在Bing地图中,缩放级别20和21是鸟眼图像,投影类型的图像在打开图层中不可用。 Bing地图中的缩放级别1仅为2个拼贴宽度。缩放级别0将是整个单词的单个图块,不在Bing地图中使用。