获取可见的传单地图的边界框? [英] Get the bounding box of the visible leaflet map?

查看:55
本文介绍了获取可见的传单地图的边界框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一张可以平移和缩放的传单地图.如何动态获取地图边缘的纬度/经度(放大/缩小+平移后)?

I have a leaflet map that pans and zooms. How can I dynamically get the lat/long of the edges of the map (after zooming in/out + panning)?

推荐答案

正如您可能猜到的那样:

It is, as you may guess:

map.getBounds();

如果要在平移和缩放后确定边界,请使用事件,例如

If you want to get the bounds after panning and zooming, use events, like

map.on('moveend', function() { 
     alert(map.getBounds());
});

这篇关于获取可见的传单地图的边界框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆