GeographicPosition Class

Definition

Represents a position in WGS84 coordinates. This is the standard coordinate format for most GNSS receivers currently available. An instance with Latitude = Longitude = Height = 0 is considered invalid. A real GNSS receiver will never output this exact value and that position is far out in the ocean.

[System.Serializable]
public sealed class GeographicPosition : ICloneable, IEquatable<Iot.Device.Common.GeographicPosition>
[System.Serializable]
public sealed class GeographicPosition : ICloneable, IEquatable<Iot.Device.Common.GeographicPosition>, IFormattable
[<System.Serializable>]
type GeographicPosition = class
    interface ICloneable
    interface IEquatable<GeographicPosition>
[<System.Serializable>]
type GeographicPosition = class
    interface ICloneable
    interface IEquatable<GeographicPosition>
    interface IFormattable
Public NotInheritable Class GeographicPosition
Implements ICloneable, IEquatable(Of GeographicPosition)
Public NotInheritable Class GeographicPosition
Implements ICloneable, IEquatable(Of GeographicPosition), IFormattable
Inheritance
GeographicPosition
Attributes
Implements

Remarks

This object stores ellipsoidal height, depending on the GNSS receiver and the application, this needs to be transformed to geoidal height.

Constructors

GeographicPosition()

Initializes an empty geographic position

GeographicPosition(Double, Double, Double)

Creates a GeographicPosition instance from latitude, longitude and ellipsoidal height.

GeographicPosition(GeographicPosition)

Copy constructor

Properties

EllipsoidalHeight

Height over the WGS84 ellipsoid

Latitude

Latitude. Positive for north of equator, negative for south.

Longitude

Longitude. Positive for east of Greenwich, negative for west.

Methods

Clone()

Creates a copy of this instance

ContainsValidPosition()

Returns true if this instance contains a valid position. An invalid position is either when Latitude and Longitude and EllipsoidalHeight are exactly zero, when either value is NaN or when the position is out of range.

EqualPosition(GeographicPosition, Double)

Returns true if the two positions are (almost) equal. This ignores the altitude.

Equals(GeographicPosition)

Equality comparer. Compares the two positions for equality within about 1cm.

Equals(Object)

Equality comparer. Compares the two positions for equality within about 1cm.

GetDegreesMinutes(Double, Int32, Double, Int32, Double)

Returns the given angle as degree and minutes

GetDegreesMinutesSeconds(Double, Int32, Double, Double, Double, Double)

Returns the given angle as degrees, minutes and seconds

GetDegreesMinutesSeconds(Double, Int32, Double, Int32, Int32, Double)

Returns the given angle as degrees, minutes and seconds

GetHashCode()

Serves as the default hash function.

ToString()

Returns a string representation of this position.

ToString(String, IFormatProvider)

Formats this GeographicPosition instance to a string. The format string can contain up to three groups of format identifiers of the form "Xn", where X is one of

  • D: Decimal display: The value is printed in decimal notation
  • U: Decimal, unsigned: The value is printed in decimal notation, omitting the sign. When using N or E (see below), the sign is typically omitted.
  • M: Minutes: The value is displayed as degrees minutes
  • S: Seconds: The value is displayed as degrees minutes seconds A single digit after the letter indicates the number of digits for the last group (e.g. M2 uses two digits for the minutes) The first of the above letters prints the latitude, the second the longitude and the third the altitude. Additionally, the following special letters can be anywhere in the format string:
  • N: North/South: Prints "N" when the latitude is greater or equal to 0, "S" otherwise
  • E: East/West Prints "E" when the longitude is greater or equal to 0, "W" otherwise Any other letters (including spaces) are printed as-is. "Format specifier" - "Output" "D3 D3" - "10.000° 23.500°" "U3N D3E" - "10.000°N 23.500°E" "U3N D3E" - "10.500°N 23.512°E" "M2N M2E" - "10° 30.00'N 23° 30.74'E" "S1N S2N D0m" - "10° 30' 00.0"N 023° 30' 44.42"E -100m"

Operators

Equality(GeographicPosition, GeographicPosition)

Equality operator. See Equals(GeographicPosition)

Inequality(GeographicPosition, GeographicPosition)

Inequality operator. See Equals(GeographicPosition)

Explicit Interface Implementations

ICloneable.Clone()

Extension Methods

DirectionTo(GeographicPosition, GeographicPosition)

Calculates the initial angle to travel to get to another position. Calculates on the great circle, therefore the direction to the target is not constant along the path

DistanceTo(GeographicPosition, GeographicPosition)

Calculate the distance to another position

MoveBy(GeographicPosition, Angle, Length)

Move a certain distance into a direction. Where do I end?

NormalizeLongitudeTo180Degrees(GeographicPosition)

Normalizes the longitude to +/- 180° This is the common form for displaying longitudes. NormalizeLongitudeTo360Degrees(GeographicPosition) is used when the area of interest is close to the date border (in the pacific ocean)

NormalizeLongitudeTo360Degrees(GeographicPosition)

Normalizes the longitude to [0..360°) This coordinate form is advised if working in an area near the date border in the pacific ocean.

Applies to