Coordinate class
The base coordinate class, used by all feature types. It's used to represent a point in geographic coordinates.
Example:
Coordinate(1, 2); // Coordinate(1, 2)
Coordinate(1, 2).toWKT(); // 1 2
Coordinate(1, 2).toJson(); // [1, 2]
Constructors
- Coordinate(double latitude, double longitude)
-
Coordinate.fromJson(List<
double> json) -
Creates a Coordinate from a JSON List.
factory
- Coordinate.fromWKT(String wkt)
-
Creates a Coordinate from a WKT String.
factory
- Coordinate.random()
-
Returns a random Coordinate.
This is useful for testing.
factory
Properties
Methods
-
bearingTo(
Coordinate other, {AngleUnit? unit}) → double -
Returns the bearing to a different Coordinate in degrees, or specified
unit
. Uses the Haversine formula to calculate the bearing between two points. -
destination(
double distance, double bearing) → Coordinate -
Returns the Coordinate at a certain distance and bearing from the Coordinate.
distance
is in meters andbearing
is in degrees. Uses the Haversine formula to calculate the new coordinate. -
distanceTo(
Coordinate other, {DistanceUnit? unit}) → double -
Returns the distance to a different Coordinate in meters or specified
unit
. Uses the Haversine formula to calculate the distance between two points. -
interpolate(
Coordinate to, double fraction) → Coordinate -
Returns the Coordinate at a certain fraction of the distance between the Coordinate and different Coordinate,
to
. Uses the Haversine formula to calculate the new coordinate. Thefraction
is a number between 0 and 1. If thefraction
is 0, the Coordinate will be the same as the Coordinate. If thefraction
is 1, the Coordinate will be the same as theto
. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toENU(
Coordinate origin) → List< double> -
Converts the Coordinate to a ENU List with a specified
origin
. -
toJson(
) → List< double> - Converts the Coordinate to a JSON coordinate List.
-
toString(
) → String -
A string representation of this object.
override
-
toWKT(
) → String - Converts the Coordinate to a WKT String. Useless on its own, but useful for other classes.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override