2015-11-30 67 views
0

我使用OpenStreetMap和Leaflet.js全球地圖disapear

我有一張室內圖片的地圖。問題是,當我放大,街道disapears。你知道任何可以解決這個問題的東西嗎?技巧或提示!

enter image description here

enter image description here

編輯:

// Load the Map 
this.map_ = L.map($(selector)[0], { 
    center: [48.8459382, 2.2863024], 
    maxZoom: 24, 
    zoom: 20 
}); 
+1

你能分享一些你的一塊代碼或小提琴的?我們只能猜測縮放級別大於20,但OSM切片僅爲0-20。 – mattesCZ

回答

5

我想你已經使用map.options.maxZoom在一個較大的數字,讓用戶縮放,看看您的室內圖像細節。

但是,OSM切片在縮放級別19之後不可用,所以服務器返回404錯誤,並且您的切片由Error Tile(如果未指定,則只是一個灰色切片)替換。

在這種情況下,您將只需使用這2個選項(在一起)上瓷磚層告訴單張重新使用的瓷磚從較低變焦和其展開:

  • maxNativeZoom集在19.
  • maxZoom設置在任何你需要的,如果指定等於map.options.maxZoom
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', { 
    maxNativeZoom: 19, // OSM max available zoom is at 19. 
    maxZoom: 22 // Match the map maxZoom, or leave map.options.maxZoom undefined. 
}).addTo(map); 

演示:http://jsfiddle.net/ve2huzxw/68/

+1

你真正的MVP兄弟 –