GDistance class

Calculates the distance between points.

Default algorithm is distanceWithVincenty, default radius is EARTH_RADIUS

 final Distance distance = new Distance();

 // km = 423
 final int km = distance.as(LengthUnit.Kilometer,
    new LatLng(52.518611,13.408056),new LatLng(51.519475,7.46694444));

 // meter = 422592
 final int meter = distance(new LatLng(52.518611,13.408056),new LatLng(51.519475,7.46694444));
Implemented types
Implementers

Constructors

GDistance({bool roundResult = true, DistanceCalculator calculator = const Vincenty()})
const
GDistance.withRadius(double radius, {bool roundResult = true, DistanceCalculator calculator = const Vincenty()})

Properties

calculator DistanceCalculator
Returns either Haversine oder Vincenty calculator
no setter
hashCode int
The hash code for this object.
no setterinherited
radius double
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

as(LengthUnit unit, GeoLatLng p1, GeoLatLng p2) num
Converts the distance to the given LengthUnit
bearing(GeoLatLng p1, GeoLatLng p2) double
Returns the great circle bearing (direction) in degrees to the next point (p2)
call(GeoLatLng p1, GeoLatLng p2) num
Shortcut for distance
distance(GeoLatLng p1, GeoLatLng p2) num
Computes the distance between two points.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
offset(GeoLatLng from, num distanceInMeter, num bearing) GeoLatLng
Returns a destination point based on the given distance and bearing
override
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited