Latest 1.0.2
Homepage https://github.com/dastrobu/vincenty
License MIT
Platforms ios 11.0, osx 10.13

Swift Version
Platform
Build Travis-CI Status

Solver for the inverse geodesic problem in Swift.

The inverse geodesic problem must be solved to compute the distance between two points on an oblate spheroid, or
ellipsoid in general. The generalization to ellipsoids, which are not oblate spheroids is not further considered here,
hence the term ellipsoid will be used synonymous with oblate spheroid.

The distance between two points is also known as the
Vincenty distance.

Here is an example to compute the distance between two points (the poles in this case) on the
WGS 84 ellipsoid.

import vincenty
let d = try distance((lat: Double.pi / 2,lon: 0), (lat: -Double.pi / 2, lon: 0))

and that’s it.

Implementation Details

This is a simple implementation of Vincenty’s formulae. It is not the most accurate or most
stable algorithm, however, easy to implement.
There are more sophisticated implementations, see, e.g.
geodesic.

Convergence and Tolerance

Convergence and the accuracy of the result can be controlled via two parameters.

try distance((lat: 0,lon: 0), (lat: 0, lon: 0), tol: 1e-10, maxIter: 200)

WGS 84 and other Ellipsoids

By default the
WGS 84 ellipsoid
is employed, but different parameters can be specified, e.g. for the
GRS 80 ellipsoid.

try distance((lat: Double.pi / 2, lon: 0), (lat: -Double.pi / 2, lon: 0), 
             ellipsoid (a: 6378137.0, f: 1/298.257222100882711))

Latest podspec

{
    "name": "vincenty",
    "version": "1.0.2",
    "summary": "Compute vincenty distance in Swift",
    "description": "see https://github.com/dastrobu/vincenty.",
    "homepage": "https://github.com/dastrobu/vincenty",
    "license": {
        "type": "MIT"
    },
    "authors": "Daniel Strobusch",
    "swift_version": "4.0",
    "platforms": {
        "ios": "11.0",
        "osx": "10.13"
    },
    "source": {
        "git": "https://github.com/dastrobu/vincenty.git",
        "tag": "1.0.2"
    },
    "source_files": [
        "Sources",
        "Sources/**/*.swift"
    ],
    "exclude_files": ".travis.yml"
}

Pin It on Pinterest

Share This