从当前缩放谷歌地图获取边界经度和纬度
我需要知道当前区域四个角的经度和纬度 如这张图片
我已经尝试过此操作,但没有运气:
map.getBounds();
有任何帮助吗?
i need to know long and lat of my four corners of current area
as in this image
i have tried this but with no luck :
map.getBounds();
any help ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
你已经成功了一半。您需要做的就是获取地图边界,然后提取(并正确使用)角点的坐标。
您可以从上面的两个角中获得西北角和东南角:
请记住,地图必须已经初始化,否则地图边界为空或未定义。
如果您想更新视口的每次更改,请使用
idle
事件侦听器:You are half way there. All you need to do is to get the map bounds and then extract (and properly use) the coordinates of the corners.
You get north-west and south-east corners from the two above:
Just keep in mind that the map has to be already initialized, otherwise the map bounds are null or undefined.
If you want to be updated about every change of the viewport, use
idle
event listener:在Android中,你可以通过这种方式找到角点LatLng(东北、西南),
在地图中,每次相机监听(意味着手势检测)时,它们都会被调用,
............
In Android, you can find out corner LatLng (northeast, southwest) by this way,
in the map, every time the camera listen(means gesture detect) they are called,
............