How to get Latitude/Longitude span in Google Map V2 for Android

前端 未结 4 1127
旧时难觅i
旧时难觅i 2020-12-08 22:22

I have a task for move my app to Google Maps Android APIs V2. Now, I need to get Latitude/Longitude span. I used MapView.getLatitudeSpan() and MapView.get

4条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-08 23:22

    You can use the following code to get the lat/lng span:

    VisibleRegion vr = mMap.getProjection().getVisibleRegion();
    double left = vr.latLngBounds.southwest.longitude;
    double top = vr.latLngBounds.northeast.latitude;
    double right = vr.latLngBounds.northeast.longitude;
    double bottom = vr.latLngBounds.southwest.latitude;
    

    I hope this helps.

提交回复
热议问题