Sree Reddy Menon
Sree Reddy Menon

Reputation: 1311

calculating BOUNDS of google maps

m working with google maps for the first time. and my app api needs bounds of google map as a paramater. i dont know how to calculate it?

I have searched a bit but couldnt able to get anything.

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

Thanks..

Upvotes: 0

Views: 954

Answers (1)

Sree Reddy Menon
Sree Reddy Menon

Reputation: 1311

To get the bounds of current visible position of google map

VisibleRegion vr = googleMap.getProjection().getVisibleRegion();
        LatLng sw = vr.latLngBounds.southwest;
        LatLng ne = vr.latLngBounds.northeast;
        LatLngBounds bounds = new LatLngBounds(sw, ne);

the the four points will be your southwest latitude,longitude and northeast latitude, longitude .

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

Upvotes: 3

Related Questions