The following functions define the distance between 2 points in CG views and in geographic space.
First a simple C function for CGPoints;
float distanceBetweenPoints(CGPoint a, CGPoint b) {
float deltaX = a.x - b.x;
float deltaY = a.y - b.y;
return sqrtf( (deltaX * deltaX) + (deltaY * deltaY) );
}
In a geographic space it's more difficult because although latitude distances are constant (approx 1 nautical mile = 1 minute of latitude) longitude distances vary as the longitude lines converge towards the poles. This website:
provides all of the simple math required to find actual distance using latitude & longitude on Earth. (distances of under 10 - 20 miles can generally use the simple equation above)