Posted By

espinallab on 02/03/10


Tagged


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

bobbym245
Tintenklecks


Calculate distance between two latitudes / longitudes


 / Published in: Objective C
 

URL: http://www.iphonedevsdk.com/forum/iphone-sdk-development/35043-calculate-distance-between-two-latitudes-longitudes.html

  1. CLLocation *userLoc = [[CLLocation alloc] initWithCoordinate:appDelegate.mapView2.userLocation.coordinate];
  2. CLLocation *poiLoc = [[CLLocation alloc] initWithLatitude: [aPOI.latitude doubleValue] longitude: [aPOI.longitude doubleValue]];
  3.  
  4. double dist = [userLoc getDistanceFrom:poiLoc] / 1000;
  5.  
  6. NSLog(@"%f",dist);

Report this snippet  

You need to login to post a comment.