簡體   English   中英

如何解決該Leaflet錯誤? getPixelWorldBounds()

[英]How can I resolve this Leaflet error? getPixelWorldBounds()

有誰知道嘗試創建傳單地圖時可能導致以下錯誤的原因? 它與自定義CRS有關。 由於種種原因,我不能發布太多代碼,因此,如果有人可以指出正確的方向,我將不勝感激。

this._map.getPixelWorldBounds()為null

L.map(containerId, {
    maxBounds: L.latLngBounds(L.latLng(-90, -180), L.latLng(90,180)),
    maxZoom: 15,
    minZoom: 1,
    center: centerLatLng,
    zoom: 2,
    crs: getCrs(),
    worldCopyJump: true,
    zoomControl: false,
    attributionControl: false
});

function getCrs() {
    return new L.Proj.CRS('EPSG:4326', '+proj=longlat +datum=WGS84 +no_defs', {
        origin: [-180, 90],
        tileSize: 512,
        resolutions: [...]
    });
}
//Removed resolutions for brevity.

我確實有這個問題,可以通過使用Proj4Leaflet將EPSG:32661支持添加到Leaflet中。

Uncaught TypeError: Cannot read property 'getSize' of null
    at NewClass._onZoomEnd (leaflet-src.js?8af6:13235)
    at NewClass.whenReady (leaflet-src.js?8af6:4450)
    at NewClass.addHooks (leaflet-src.js?8af6:13157)
    at NewClass.enable (leaflet-src.js?8af6:5722)
    at NewClass.addHandler (leaflet-src.js?8af6:3736)
    at NewClass.init (leaflet-src.js?8af6:385)
    at NewClass.proto.callInitHooks (leaflet-src.js?8af6:357)
    at NewClass.initialize (leaflet-src.js?8af6:3148)
    at new NewClass (leaflet-src.js?8af6:301)
    at Map.createLeafletElement (Map.js?fe6c:87)

我發現問題是由於使用worldCopyJump 通過刪除它,錯誤消失了。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM