Created
March 26, 2014 10:00
-
-
Save mpaloulack/9780046 to your computer and use it in GitHub Desktop.
Get distance between 2 locations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(float)kilometersfromPlace:(CLLocationCoordinate2D)from andToPlace:(CLLocationCoordinate2D)to { | |
CLLocation *userloc = [[CLLocation alloc]initWithLatitude:from.latitude longitude:from.longitude]; | |
CLLocation *dest = [[CLLocation alloc]initWithLatitude:to.latitude longitude:to.longitude]; | |
CLLocationDistance dist = [userloc distanceFromLocation:dest]*4; | |
NSString *distance = [NSString stringWithFormat:@"%f",dist]; | |
return [distance floatValue]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment