简体   繁体   中英

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. 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!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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