如何获得纬度/经度跨度在谷歌地图V2为Android [英] How to get Latitude/Longitude span in Google Map V2 for Android
本文介绍了如何获得纬度/经度跨度在谷歌地图V2为Android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有我的移动应用程序,谷歌地图的Android的API V2的任务。现在,我需要得到纬度/经度跨度。我用 MapView.getLatitudeSpan()
和 MapView.getLongitudeSpan()
在previous版本的API。现在,我找不到这样的事情在V2。
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.getLongitudeSpan()
in previous version APIs. Now I can't find something like this in V2.
没有任何人有同样的问题?
Does anybody have the same problem?
推荐答案
您可以使用下面的code,以获得纬度/经度跨度:
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.
这篇关于如何获得纬度/经度跨度在谷歌地图V2为Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文