great_circle_distance 1.0.1 copy "great_circle_distance: ^1.0.1" to clipboard
great_circle_distance: ^1.0.1 copied to clipboard

Calculate the great-circle distance on the Earth having a pair of Latitude,Longitude points using the Spherical law of cosines, Haversine formula or Vincenty`s formula

example/great_circle_distance_example.dart

import 'package:great_circle_distance/great_circle_distance.dart';

main() {
    final lat1 = 41.139129;
    final lon1 = 1.402244;

    final lat2 = 41.139074;
    final lon2 = 1.402315;

    var gcd = new GreatCircleDistance.fromDegrees(
        latitude1: lat1, longitude1: lon1, latitude2: lat2, longitude2: lon2);

    print(
        'Distance from location 1 to 2 using the Haversine formula is: ${gcd.haversineDistance()}');
    print('Distance from location 1 to 2 using the Spherical Law of Cosines is: ${gcd
        .sphericalLawOfCosinesDistance()}');
    print(
        'Distance from location 1 to 2 using the Vicenty`s formula is: ${gcd.vincentyDistance()}');
}
6
likes
40
pub points
59%
popularity

Publisher

verified publisheryeradis.com

Calculate the great-circle distance on the Earth having a pair of Latitude,Longitude points using the Spherical law of cosines, Haversine formula or Vincenty`s formula

Homepage

License

MIT (LICENSE)

More

Packages that depend on great_circle_distance