How to get LatLngBounds of visible region in titled map in andorid

帅比萌擦擦* 提交于 2020-01-03 03:01:08

问题


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


回答1:


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!



来源:https://stackoverflow.com/questions/44268609/how-to-get-latlngbounds-of-visible-region-in-titled-map-in-andorid

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!