计算谷歌地图的BOUNDS

时间:2015-03-02 22:41:02

标签: android google-maps

第一次使用谷歌地图。和我的应用程序api需要谷歌地图的边界作为参数。我不知道如何计算它?

我搜索了一下但是无法得到任何东西。

33.867269,151.200857,-33.862022,151.215449 //look like this.. 

谢谢..

1 个答案:

答案 0 :(得分:3)

获取谷歌地图当前可见位置的界限

VisibleRegion vr = googleMap.getProjection().getVisibleRegion();
        LatLng sw = vr.latLngBounds.southwest;
        LatLng ne = vr.latLngBounds.northeast;
        LatLngBounds bounds = new LatLngBounds(sw, ne);
这四个点将是您的西南纬度,经度和东北纬经度。

 bounds.southwest.latitude , bounds.southwest.longitude ,bounds.northeast.latitude , bounds.northeast.longitude