Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Finding distance between CLLocationCoordinate2D points

I know from documentation we can find distance between two CLLocation points using the function, distanceFromLocation:. But my problem is I dont have CLLocation data type with me, I have the CLLocationCoordinate2D points. So how can I find distance between two CLLocationCoordinate2D points. I have seen the post post but not helpful for me.

like image 826
rakeshNS Avatar asked Jun 18 '12 05:06

rakeshNS


1 Answers

You should create an object of CLLocation using,

- (id)initWithLatitude:(CLLocationDegrees)latitude     longitude:(CLLocationDegrees)longitude; 

Then, you should be able to calculate the distance using

[location1 distanceFromLocation:location2]; 
like image 50
Apurv Avatar answered Sep 22 '22 11:09

Apurv