1

有谁知道在尝试创建传单地图时可能导致以下错误的原因是什么?它与自定义 CRS 有关。由于各种原因,我不能发布很多代码,所以如果有人能指出我正确的方向,我将不胜感激。

this._map.getPixelWorldBounds() 为空

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.
4

1 回答 1

0

我确实遇到了这个问题,通过使用Proj4Leaflet向 Leaflet 添加 EPSG:32661 支持。

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. 通过删除它,错误消失。

于 2019-03-08T17:18:49.637 回答