Just a quick question on Core Location, I\'m trying to calculate the distance between two points, code is below:
-(void)locationChange:(CLLocation *)newL
Taken from the excellent libary CoreLocation utitlities :
- (CLLocationDistance) distanceFromCoordinate:(CLLocationCoordinate2D) fromCoord;
{
double earthRadius = 6371.01; // Earth's radius in Kilometers
// Get the difference between our two points then convert the difference into radians
double nDLat = (fromCoord.latitude - self.coordinate.latitude) * kDegreesToRadians;
double nDLon = (fromCoord.longitude - self.coordinate.longitude) * kDegreesToRadians;
double fromLat = self.coordinate.latitude * kDegreesToRadians;
double toLat = fromCoord.latitude * kDegreesToRadians;
double nA = pow ( sin(nDLat/2), 2 ) + cos(fromLat) * cos(toLat) * pow ( sin(nDLon/2), 2 );
double nC = 2 * atan2( sqrt(nA), sqrt( 1 - nA ));
double nD = earthRadius * nC;
return nD * 1000; // Return our calculated distance in meters
}