Вот код для этого ..
-(NSString *)findDistanceBetweenTwoLatLon
{
int intEarthRadius = 3963;
double dblLat1 = DegreesToRadians(firstLatitude);
double dblLon1 = DegreesToRadians(firstLongitude);
double dblLat2 = DegreesToRadians(secondLatitude);
double dblLon2 = DegreesToRadians(secondLongitude);
float fltLat = dblLat2 - dblLat1;
float fltLon = dblLon2 - dblLon1;
double a = sin(fltLat/2) * sin(fltLat/2) + cos(dblLat2) * cos(dblLat2) * sin(fltLon/2) * sin(fltLon/2) ;
double c = 2 * atan2(sqrt(a), sqrt(1-a));
double d = intEarthRadius * c;
double dMeters = d * kOneMileMeters;
NSString *strDistance = [NSString stringWithFormat:@"%1.2f meters",dMeters];
return strDistance;
}
Определите все эти макросы ..
и для градусов в радианах
#define DegreesToRadians(degrees) (degrees * M_PI / 180)
где M_PI
#define M_PI 3.14159265358979323846264338327950288
#define kOneMileMeters 1609.344