如何在BING层中设置maxZoom以在18之后插值

时间:2018-12-21 09:19:14

标签: leaflet

我正在尝试“放大”(如果不可能的话,请通过插值,再插入18来)...

var BING_KEY = 'AuhiCJHlGzhg93IqUH_oCpl_-ZUrIE6SPftlyGYUvr9Amx5nzA-WqGcPquyFZl4L'

var map = L.map('map').setView([1.2862100, 103.8541900], 18)
map.options.maxZoom = 20;  // NOT WORKING
map.options.maxNativeZoom = 18;  // NOT WORKING

var bingLayer = L.tileLayer.bing(BING_KEY).addTo(map)

18点(单击“ +”)后,它不起作用(空白图像)

请参见Leaflet-JS BING-layer

1 个答案:

答案 0 :(得分:1)

options available for a L.Mapoptions available for a L.TileLayer不同。请注意MapTileLayer都具有不同含义的maxZoom选项,以及TileLayer如何从maxNativeZoom类继承GridLayer选项

因此,将选项应用于TileLayer而不是Map

var map = L.map('map');
var bingLayer = L.tileLayer.bing({bingKey: 'ABCD', maxNativeZoom: 18, maxZoom: 20}).addTo(map);