An Objective-C port of the Latitude/longitude spherical geodesy formulae & scripts by Chris Veness. Read more about it here: http://www.movable-type.co.uk/scripts/latlong.html
This is only a partial port. Feel free to fork and add more.
This is a fork of BJ Basañes original SLatLong. I wanted a different coding style, hence, this repo.
- Get the distance from one point to another with the earth radius.
JPCoordinate pointA = {37.30, -121.91};
JPCoordinate pointB = {57.30, -120.91};
double distance = [JPGeodesy distanceFromPoint:pointA toPoint:pointB radius:6371];
- Find the bearing (direction) between two points
JPCoordinate pointA = {37.30, -121.91};
JPCoordinate pointB = {57.30, -120.91};
double bearing = [JPGeodesy bearingFromPoint:pointA toPoint:pointB];
- Finding the destination point based on a origin, distance, radius (from earth) and bearing (direction).
JPCoordinate pointA = {37.30, -121.91};
JPCoordinate pointB = [JPGeodesy destinationPointFromPoint:pointA withBearing:180.0 distance:1900 radius:6371];
NSLog("latitude:%f longitude:%f", pointB.latitude, pointB.longitude);
You can just drag the source files, but you get extra points for being awesome and using CocoaPods.