如何获得纬度/经度跨度在谷歌地图V2为Android经度、纬度、跨度、如何获得

2023-09-12 23:57:33 作者:有个逗比叫xx

我有我的移动应用程序,谷歌地图的Andr​​oid的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.

 
精彩推荐