I want to zoom
the Google map
to a specific radius in miles say 10 miles/20 miles/30 miles etc as per my condition in android.
What I need is to draw a circle of specific radius (10/20/30.. miles) from the current lat long point and zoom the map to that particular miles for which i have draw the circle with radius.
I am able to point my current position, Draw the circle. But I am not able to zoom the map to desired radius mile only(circle should be focus on the screen with specified miles with my current position as center).
Currently I am using the following code to zoom:
gooMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(selectedLat, selectedLong), 15));
gooMap.animateCamera(CameraUpdateFactory.zoomTo(10), 2000, null);
Log.e("Circle Lat Long:", selectedLat + ", " + selectedLong);
circle.remove();
circle = gooMap.addCircle(new CircleOptions()
.center(new LatLng(selectedLat, selectedLong))
.radius(iMiles * 1609.34) // Converting Miles into Meters...
.strokeColor(Color.RED)
.strokeWidth(5));
circle.isVisible();
I knew that giving the zoom level to 15 will not zoom the map to the desire miles. But I need to zoom the map to desire miles radius. how can i achieve it. Can anyone can help me for the same.
Edit:- Image added explains what I need in details.
Image_1:- When I set my radius to say 10 miles then the map should zoom as shown.
Image_2 When I set my radius to say 50 miles then the map should zoom as shown.
Please see the difference in the map places to analysis the zoom level I need.
Thanks in advance.