Geographic class

A geographic position with longitude, latitude and optional elevation and m.

Longitude is available at lon, latitude at lat and elevation at elev. m represents a measurement.

Longitude (range [-180.0, 180.0]) and latitude (range [-90.0, 90.0]) are represented as deegrees. The unit for elev is meters.

Geographic coordinates are based on a spherical or ellipsoidal coordinate system representing positions on the Earth as longitude (lon) and latitude (lat).

m represents a measurement or a value on a linear referencing system (like time). It could be associated with a 2D position (lon, lat, m) or a 3D position (lon, lat, elev, m).

For 2D coordinates the coordinate axis indexes are:

Index Geographic
0 lon
1 lat
2 m

For 3D coordinates the coordinate axis indexes are:

Index Geographic
0 lon
1 lat
2 elev
3 m
Inheritance
Available Extensions
Annotations
  • @immutable

Constructors

Geographic({required double lon, required double lat, double? elev, double? m})
A geographic position with lon and lat, and optional elev and m.
const
Geographic.build(Iterable<num> coords, {int offset = 0, Coords? type})
Builds a geographic position from coords starting from offset.
factory
Geographic.create({required double x, required double y, double? z, double? m})
A position from parameters compatible with CreatePosition function type.
const
Geographic.parse(String text, {Pattern delimiter = ',', Coords? type, bool swapXY = false})
Parses a geographic position from text.
factory
Geographic.parseDms({DmsFormat format = const Dms(), required String lon, required String lat, String? elev, String? m})
Parses a geographic position from lon and lat text values that are formatted as specified (and parsed) by format.
factory

Properties

conforming PositionScheme
Returns a position scheme this position is conforming to.
no setteroverride
coordinateDimension int
The number of coordinate values (2, 3 or 4) on a position.
no setterinherited
coordType Coords
A value of Coords representing the coordinate type of position data contained directly or within child objects.
no setterinherited
elev double
The elevation (or altitude) coordinate in meters.
no setter
hashCode int
The hash code for this object.
no setteroverride
is3D bool
True for 3D positions (with z or elevation coordinate).
no setteroverride
isMeasured bool
True if a measure value is available (or the m coordinate for a position).
no setteroverride
lat double
The latitude coordinate.
no setter
lon double
The longitude coordinate.
no setter
m double
The m ("measure") coordinate value. Returns zero if not available.
no setteroverride
optElev double?
The elevation (or altitude) coordinate optionally in meters.
no setter
optM double?
The m ("measure") coordinate optionally. Returns null if not available.
no setteroverride
optZ double?
The z coordinate value optionally. Returns null if not available.
no setteroverride
positionCount int
A Position object represents a single position, returns always 1.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
spatialDimension int
The number of spatial coordinate values (2 for 2D or 3 for 3D) on a position.
no setterinherited
type Coords
The coordinate type.
no setterinherited
valueCount int
The number of coordinate values contained.
no setterinherited
values Iterable<double>
Coordinate values of this position as an iterable of 2, 3 or 4 items.
no setterinherited
x double
The x coordinate value.
no setteroverride
y double
The y coordinate value.
no setteroverride
z double
The z coordinate value. Returns zero if not available.
no setteroverride

Methods

bearingTo2D(Position destination) double
Returns a bearing from this to destination calculated in a cartesian 2D plane.
inherited
copyByType(Coords type) Geographic
Copies this as another object according to the given type.
override
copyTo<R extends Position>(CreatePosition<R> factory) → R
Copies this position to a new position created by the factory.
inherited
copyWith({double? x, double? y, double? z, double? m}) Geographic
Copies the position with optional x, y, z and m overriding values.
override
destinationPoint2D({required double distance, required double bearing}) Geographic
Returns a destination point located at the given distance from this to the direction of bearing calculated in a cartesian 2D plane.
override
distanceTo2D(Position destination) double
Returns a distance from this to destination calculated in a cartesian 2D plane.
inherited
distanceTo3D(Position destination) double
Returns a distance from this to destination calculated in a cartesian 3D space.
inherited
equals2D(covariant Position other, {double toleranceHoriz = defaultEpsilon}) bool
True if this position equals with other by testing 2D coordinates only.
inherited
equals3D(covariant Position other, {double toleranceHoriz = defaultEpsilon, double toleranceVert = defaultEpsilon}) bool
True if this position equals with other by testing 3D coordinates only.
inherited
equalsCoords(covariant Position other) bool
True if this and the other position equals.
inherited
expand(ExpandPosition expand) Iterable<Geographic>
Expands this position to an iterable of zero or more positions of using expand.
override
intermediatePointTo(Position destination, {required double fraction}) Geographic
Returns an intermediate point at the given fraction between this and destination positions calculated in the cartesian coordinate reference system.
override
latDms([DmsFormat format = const Dms()]) String
Formats lat according to format.
latLonDms({DmsFormat format = const Dms(), String separator = ', ', String elevUnits = 'm', int elevDecimals = 2, String mUnits = '', int mDecimals = 2}) String
Formats lat and lon according to format, with lat formatted first and separated from lon by separator.
lonDms([DmsFormat format = const Dms()]) String
Formats lon according to format.
midPointTo(Position destination) Geographic
Returns a midpoint between this and destination positions calculated in the cartesian coordinate reference system.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
packed() Geographic
Returns a position instance whose coordinate storage contains only coordinate values represented by this position.
override
project(Projection projection) Projected
Projects this geographic position to a projected position using the forward projection.
override
toString() String
A string representation of this object.
override
toText({String delimiter = ',', int? decimals, bool compactNums = true, bool swapXY = false}) String
A string representation of coordinate values separated by delimiter.
inherited
transform(TransformPosition transform) Geographic
Returns a position transformed from this using transform.
override
valuesByType(Coords type) Iterable<double>
Coordinate values as a double iterable according to the given type.
inherited

Operators

operator %(Position divisor) Geographic
Returns a position with coordinate values of this applied with modulo operator % by values of divisor.
override
operator *(double factor) Geographic
Returns a position with coordinate values of this scaled by factor.
override
operator +(Position other) Geographic
Returns a position with coordinate values summed from this and other.
override
operator -(Position other) Geographic
Returns a position with coordinate values of this subtracted with values of other.
override
operator /(Position divisor) Geographic
Returns a position with coordinate values of this divided by values of divisor.
override
operator ==(Object other) bool
The equality operator.
override
operator [](int index) double
A coordinate value by the coordinate axis index.
inherited
operator unary-() Geographic
Returns a position with coordinate values of this negated.
override

Static Methods

from(Position source) Geographic
Creates a geographic position by copying coordinates from source.
writeLatLonDms(StringSink buf, Geographic position, {DmsFormat format = const Dms(), String separator = ' ', String elevUnits = 'm', int elevDecimals = 2, String mUnits = '', int mDecimals = 2}) → void
Formats geographic position according to format and writes it to buf.

Constants

scheme → const PositionScheme
A position scheme that creates Geographic and GeoBox instances for positions and bounding boxes.