(Revised Question based on comment:)
OK I will try to ask in other way...How can I get border coordinates of this circle overlay:
(Original Question:)
I am having weird problem with my iPhone app. I have MKCoordinateRegion which has center coordinate latitude: 51.509980 and longitude: -0.133700. I have used method MKCoordinateRegionMakeWithDistance and set the distance to be 16,093.44 meters (10 miles).
I want to get border point of this region therefore I have this code:
MKCoordinateRegion region2 = self.myMapView.region;
float minLat = region2.center.latitude - (region2.span.latitudeDelta / 2.0);
float maxLat = region2.center.latitude + (region2.span.latitudeDelta / 2.0);
float minLong = region2.center.longitude - (region2.span.longitudeDelta / 2.0);
float maxLong = region2.center.longitude + (region2.span.longitudeDelta / 2.0);
I found this website for my testing http://boulter.com/gps/distance/ which calculates distance between two coordinates. When I enter as a FROM coordinate: 51.509980 and longitude: -0.133700 (London) and TO coordinate:
2011-11-26 01:15:42.830 NearMeTest[3911:11603] MinLAT 51.334381 and MaxLAT 51.684814
2011-11-26 01:15:42.830 NearMeTest[3911:11603] MinLONG -0.352936 and MaxLONG 0.086517
I get that the distance between those two coordinates is 15.40 miles instead of expected 10 miles.
Screenshot:
Why such a difference? When I tried to do the same but from different center coordinates (Tokyo, New York) result were correct 10 miles.
Thanks for reply
In your screenshot of the web form, you're getting a different distance because the line you're measuring (center to MinLAT / MinLONG) is diagonal and extends beyond the circle radius.
If you follow @AnnaKarenina's answer, you can then get the distance in meters by converting each
CLLocationCoordinate2D
into aCLLocation
.Here's how you'd get the radius in miles: