Great Circle Distance

Plugin for calculating Great Circle Distance by Spherical Law of Cosines.

Spherical Law of Cosines

The great-circle distance, orthodromic distance, or spherical distance is the distance along a great circle. It is the shortest distance between two points on the surface of a sphere, measured along the surface of the sphere (as opposed to a straight line through the sphere's interior).

Usage

// The Geolocation of St.Mary Cathedral
double lat1 = 16.77858116672366, lon1 = 96.1657684686045;

// The Geolocation of St. Peter's Basilica
double lat2 = 41.90219864557144, lon2 = 12.454035933187363;

// The distance in km.
double? _theDistance = await GreatCircleDistance.calculate(
    lat1: lat1,
    lon1: lon1,
    lat2: lat2,
    lon2: lon2,
);