1
Q
單張離線網格圖層
A
回答
2
這是一個自定義GridLayer
(這已由Leaflet作者實施)。您所要做的就是複製L.GridLayer.DebugCoords
,您通常會在其中加載圖塊圖層。
var map = L.map('map', {
center: [0, 0],
zoom: 0
});
L.GridLayer.DebugCoords = L.GridLayer.extend({
createTile: function (coords, done) {
var tile = document.createElement('div');
//this adds tile coordinates; you may or may not want this
tile.innerHTML = [coords.x, coords.y, coords.z].join(', ');
tile.style.outline = '1px solid red';
/* // you don't need this artificial timeout for your application
setTimeout(function() {
done(null, tile); // Syntax is 'done(error, tile)'
}, 500 + Math.random() * 1500);
*/
return tile;
}
});
L.gridLayer.debugCoords = function(opts) {
return new L.GridLayer.DebugCoords(opts);
};
map.addLayer(L.gridLayer.debugCoords());
單機,工作示例:http://leafletjs.com/examples/extending/extending-2-layers.html
:取自 http://leafletjs.com/examples/extending/gridcoords.html代碼
相關問題
- 1. 動態單張圖層類
- 2. GoJS單張圖層縮放
- 3. 單張圖層控制:選擇圖層組內的圖層?
- 4. 單張縮放地圖圖層
- 5. 單張矢量圖層 - popup模板
- 6. 切換單張中的所有圖層
- 7. 以編程方式移除單張覆蓋圖層圖層
- 8. 將CartoDb圖層添加到單張圖層控件
- 9. 單張圖層控件不顯示圖層
- 10. ASP.NET - 分層網格視圖
- 11. 分層網格視圖
- 12. 使圖像脫離網格
- 13. 離線傳單地圖
- 14. 核心情節:網格線每兩張圖出現一次
- 15. 壞可讀WMS層 - 單張
- 16. 在離散x軸上指定次要網格線/一些虛線網格線
- 17. 分層網格
- 18. 單張問題:製作多段線的圖層組不可點擊
- 19. 網站離線jsp
- 20. NSURLConnection帶圖像的離線網頁
- 21. 是否有可用於Leaflet的離線地圖圖層?
- 22. 單張:geojson圖層上的標記圖標大小
- 23. 使用rCharts和Leaflet去除單張熱圖圖層
- 24. 將JSON圖層添加到單張地圖
- 25. 生成彩色地圖圖層,用R爲單張
- 26. 圖表網格線樣式
- 27. 圖形從軸+網格線
- 28. 甘特圖或分層網格
- 29. 在altair網格分層圖/ Vega-Lite
- 30. 蜘蛛網圖圓形網格線插值:標籤看起來離Plotline很遠