使用 Leaflet.js 如何在拖动端获得地图 lat/lon?
Using Leaflet.js how do I get map lat/lon on drag end?
我正在使用 leaflet.js 并且很容易将它与我的代码集成。我无法在 google 地图中找到拖动结束事件的坐标。所以请任何人都可以建议如何做到这一点。感谢您提供任何帮助和建议。
var map = L.map('map', {center: latlng, zoom: 13, layers: [tiles]});
var markers = L.markerClusterGroup({ chunkedLoading: true });
showData(map,markers);
map.on('dragend',function(e){
console.log("console.log", e);
console.log(e.target.latLngToContainerPoint);
//showData(map,markers,e.target._animateToCenter.lat, e.target._animateToCenter.lng , e.distance)
});
能不能只在拖动端获取地图中心?
map.on('dragend',function(e){
console.log(map.getCenter());
});
参见示例 http://codepen.io/sphvn/pen/GJbxBw?editors=001
如果这不是您想要的,请您澄清您的问题。
我正在使用 leaflet.js 并且很容易将它与我的代码集成。我无法在 google 地图中找到拖动结束事件的坐标。所以请任何人都可以建议如何做到这一点。感谢您提供任何帮助和建议。
var map = L.map('map', {center: latlng, zoom: 13, layers: [tiles]});
var markers = L.markerClusterGroup({ chunkedLoading: true });
showData(map,markers);
map.on('dragend',function(e){
console.log("console.log", e);
console.log(e.target.latLngToContainerPoint);
//showData(map,markers,e.target._animateToCenter.lat, e.target._animateToCenter.lng , e.distance)
});
能不能只在拖动端获取地图中心?
map.on('dragend',function(e){
console.log(map.getCenter());
});
参见示例 http://codepen.io/sphvn/pen/GJbxBw?editors=001
如果这不是您想要的,请您澄清您的问题。