如何在Andorid的带标题的地图中获取可见区域的LatLngBounds [英] How to get LatLngBounds of visible region in titled map in andorid

查看:226
本文介绍了如何在Andorid的带标题的地图中获取可见区域的LatLngBounds的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试了以下代码.

    LatLngBounds b = googleMap.getProjection()
                              .getVisibleRegion().latLngBounds;
    LatLng bNE = b.northeast;
    LatLng bSW = b.southwest;

如果将倾斜度设置为地图,则不会给出正确的边界坐标

It's not giving correct bounding coordinates if tilt is set to the map

推荐答案

如Google Maps API文档

As mentioned in the Google Maps API doc VisibleRegion, the visible region for a map's camera can be in the form of a rectangle in case the camera is centered over the map region which will give you correct bounding coordinates. While it can also be in the form of a trapezoid, in case the camera has tilt, which is your case.

这就是为什么您得到错误的边界坐标!

That's why you're getting wrong bounding coordinates!

这篇关于如何在Andorid的带标题的地图中获取可见区域的LatLngBounds的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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