In an iPhone App how can you calculate distance between two points in MKMapView
as shown in the image below?
The first point would be the center point of the visible map in the mapview.
The 2nd point would be any of corner of the visible rectangle of the mapview (here, for example I have taken the top left point).
I want to calculate this distance in meters. How can I achieve that?
My goal is to calculate the ratios of the visible Map rectangle in MKMapview
.
You can get lat/lon of the center with:
convertPoint:toCoordinateFromView:
loc1 and loc2 are both CLLocation objs.
CLLocationDistance dist = [loc1 distanceFromLocation:loc2];
So these two tips should help you. if you need some code, let me know :-)
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