I want to draw a static circle over a map with Google Maps
. When the user pinches, the map will zoom in/out.
I need to know the map radius (related to the area contained in the circle) and change the seekbar at the bottom accordingly.
Does anybody know a solution how to retrieve the distance from the left to the right screen edge? I didn't find anything at the Google Maps API doc.
Something like this:
Google Maps is making it a whole lot easier to find out exactly how far apart any two (or more) points are on a map. As of yesterday, you can now right click anywhere on Google Maps on the web and choose "measure distance" to bring up a digital ruler that'll tell you just how far away its final point is.
The Distance Matrix API uses a pay-as-you-go pricing model.
Latitude + (result. Span. Latitude/2); double swLon = result.
using VisibleRegion you can get the all corner cordinates and also the center.
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;
and you can calcuate distance from two region by this
Location MiddleLeftCornerLocation;//(center's latitude,vr.latLngBounds.southwest.longitude) Location center=new Location("center"); center.setLatitude( vr.latLngBounds.getCenter().latitude); center.setLongitude( vr.latLngBounds.getCenter().longitude); float dis = center.distanceTo(MiddleLeftCornerLocation);//calculate distane between middleLeftcorner and center
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With