简体   繁体   English

如何在andorid中的标题映射中获取可见区域的LatLngBounds

[英]How to get LatLngBounds of visible region in titled map in andorid

I tried the following code. 我尝试了以下代码。

    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 如果将倾斜设置为地图,则不会给出正确的边界坐标

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. 如Google Maps API文档VisibleRegion中所述,地图相机的可见区域可以采用矩形的形式,以防相机在地图区域上居中,这将为您提供正确的边界坐标。 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! 这就是为什么你得到错误的边界坐标!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM