Skip to content

Instantly share code, notes, and snippets.

@ryanhanwu
Created September 10, 2014 15:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanhanwu/7c38fde580e64e0ca7a6 to your computer and use it in GitHub Desktop.
Save ryanhanwu/7c38fde580e64e0ca7a6 to your computer and use it in GitHub Desktop.
Calculate distance between two location
#import <CoreLocation/CoreLocation.h>
CLLocation *locA = [[CLLocation alloc] initWithLatitude:lat1 longitude:long1];
CLLocation *locB = [[CLLocation alloc] initWithLatitude:lat2 longitude:long2];
CLLocationDistance distance = [locA distanceFromLocation:locB];
//Distance in Meters
//1 meter == 100 centimeter
//1 meter == 3.280 feet
//1 square meter == 10.76 square feet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment