GeoPoint class

A geographic point on Earth.

Latitude and longitude should be between -180.0 (inclusive) and 180.0 (inclusive).

Example

import 'package:kind/kind.dart';

final sanFrancisco = GeoPoint(37.7749, -122.4194);
final london = GeoPoint(51.5074, -0.1278);
final distance = sanFrancisco.distanceTo(london);
final distanceInMiles = sanFrancisco.distanceTo(london, unitOfLength: UnitOfLength.miles);
Implemented types
Annotations
  • @sealed

Constructors

GeoPoint(double latitude, double longitude)
Constructs a geographical point with latitude and longitude.

Properties

hashCode int
The hash code for this object.
no setteroverride
latitude double
Latitude. Should be in the range -180.0 <= value <= 180.0.
final
longitude double
Longitude. Should be in the range -180.0 <= value <= 180.0.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

compareTo(GeoPoint other) int
Compares this object to another object.
override
distanceTo(GeoPoint other, {UnitOfLength unitOfLength = UnitOfLength.meters}) double
Calculates distance to another geographical point.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

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

Static Properties

zero GeoPoint
GeoPoint(0.0, 0.0).
final