gpt4 book ai didi

javascript - 如何解决此传单错误? getPixelWorldBounds()

转载 作者:行者123 更新时间:2023-11-28 04:07:40 25 4
gpt4 key购买 nike

有谁知道在尝试创建传单 map 时可能导致以下错误的原因是什么?和自定义的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.

最佳答案

我正是遇到了这个问题,通过使用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 引发的。通过删除它,错误就会消失。

关于javascript - 如何解决此传单错误? getPixelWorldBounds(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46550541/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com