gpt4 book ai didi

传单圆半径根据 y/lng 坐标而变化

转载 作者:行者123 更新时间:2023-12-02 09:36:50 27 4
gpt4 key购买 nike

我使用mapbox/leaflet来显示人体图片而不是常规 map 。

我正在使用传单绘制,我需要能够创建一个圆并在保持其半径的同时移动它。然而,当我将其移向 map /屏幕底部时,大小呈指数级增加。我希望它保持相同的大小。

我认为这与投影或 CRS 有关,但我不确定如何阻止它。

我的代码是:

    var mapMinZoom = 0;
var mapMaxZoom = 4;
var map = L.map('map', {
maxZoom: mapMaxZoom,
minZoom: mapMinZoom,
crs: L.CRS.Simple,
noWrap: true,
continuousWorld: true
}).setView([0, 0], mapMaxZoom);

var mapBounds = new L.LatLngBounds(
map.unproject([0, 3840], mapMaxZoom),
map.unproject([4096, 0], mapMaxZoom));

map.fitBounds(mapBounds);
L.tileLayer('/tiles/{z}/{x}/{y}.png', {
minZoom: mapMinZoom, maxZoom: mapMaxZoom,
bounds: mapBounds,
attribution: 'Rendered with <a href="http://www.maptiler.com/">MapTiler</a>',
noWrap: true,
continuousWorld: true
}).addTo(map);

var touches;

var featureGroup = L.featureGroup().addTo(map);

var drawControl = new L.Control.Draw({
edit: {
featureGroup: featureGroup
}
}).addTo(map);

map.on('draw:created', function (e) {
featureGroup.addLayer(e.layer);
});

有什么想法吗?我不需要使用传单绘制,只需使用 L.circle 即可,但它也有同样的问题。

问题的 Gif 在这里:

enter image description here

最佳答案

事实证明,传单 0.7 代码中有大量待办事项...包括这个小 gem :

// TODO Earth hardcoded, move into projection code!

_getLatRadius: function () {
return (this._mRadius / 40075017) * 360;
},

_getLngRadius: function () {
return this._getLatRadius() / Math.cos(L.LatLng.DEG_TO_RAD * this._latlng.lat);
},

更新至0.8Dev,已全部修复!

关于传单圆半径根据 y/lng 坐标而变化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25034291/

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