LatLon
Description
A set of longitude/latitude coordinates, measured in degrees, with 64-bit floating-point precision.
A set of longitude/latitude values represent a location on a planetary body, for example on earth:
+---------------------------------------------------------------------------------+ 90°N | @@ @@@@@@@@ @@@ @ | +90° | @ @@@@@@ @ @@@@ | | @@@@ @ @@@ @ @ @@@@@ @ @ @@@@@@@@@@@@@@@@@ @ | | @@@@@@@@@@@@@@@ @@@ @@ @ @@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@ | | @@@@@@@@@@@@@@@ @ @ @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ | | @@@@@@@@@ @@@ @ @@@@@@@@@@@@@@@@@@@@@@@@@ | | @@@@@@@@@@@@@@@ @ @@ @@@@@@@@@@@ @@@@@@@@@@@@@ @ | | @@@@@@@@@@@@@@@ @@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@ | | @@@@@@@ @@@@@ @@@ @@@@@ @@ @@@@@@@@@@@@@@@ @@@@ | | @@@@@@@@@@@@@ @@ @ @ @@ @@@@@@@@@@@@@@@@@@@ @ | | @@@@@@@@@@@ @@ @@ @@@@@ @@@@@@@@@@@@@@@ | | @@@@@@@@@@@ @@@ @@@@@@@@@@ @@@@@@@@@@ @ @ | | @@@@@@@@@ @@@@@@ @@@@@@@@@@@@@@@@@@@@@@ | | @@@@ @@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@ | | @@@ @@@@@@@@@@@@ @@@@ @@@@@@ @ @@@@@ | L | @@ @ @@@@@@@@@ @@@@ @@@@@ @@@@@ @@@@@ | a | @@@@ @ @@@@@@@@ @@@@@ @@@@ @@@ @ @ | t | @@@ @@@@@@@@@@@@@@ @ @ @ @ | i | @@ @@@@@@@@@@@@@@ @ @ @@ + 0° t | @@@@@ @@ @@ @@@@@@@@@ @ @ @ @ @ | u | @@@@@@@ @@@@@@@@@@ @ | d | @@@@@@@@ @@@@@@@@@ @ @@ | e | @@@@@@@@@@@ @@@@@@@@ @ @ @@@@ | | @@@@@@@@@@@@ @@@@@@@ @ @@ | | @@@@@@@@@@@ @@@@@@@ @ | | @@@@@@@@@ @@@@@@@ @@ @ | | @@@@@@@@ @ @@ @ @@@@@@ | | @@@ @@@@ @@@@@ @ @@@@@@@@ | | @@@ @@ @ @@@ @@@@@@@@@ | | @@@@@@ @@@ @@@@@@@@@@ | | @@@@ @@@ @@@ @@@@@ | | @@@ @@@ @ | | @@ @ | | @@ @ | | @@ @ | | @ | | @ | 90°S +-----------------------------------------+---------------------------------------+ -90° 180°W 0° 180°E -180° Longitude +180°
The mapping from longitude/latitude coordinates to cubemap coordinates (see Cubemap class) is defined as follows:
Cubemap | Face center lies at: face | Longitude | Latitude --------+-----------+--------- X- | 90°W | 0°N | -90° | 0° --------+-----------+--------- X+ | 90°E | 0°N | +90° | 0° --------+-----------+--------- Y- | 0°E | 90°N | 0° | +90° --------+-----------+--------- Y+ | 0°E | 90°S | 0° | -90° --------+-----------+--------- Z- | 0°E | 0°N | 0° | 0° --------+-----------+--------- Z+ | 180°W | 0°N | -180° | 0°
Public / Constructors
FromCube
4 overloads
Converts the given cubemap coordinates to longitude/latitude coordinates.
Converts the given cubemap coordinates to longitude/latitude coordinates.
Converts the given cubemap coordinates to longitude/latitude coordinates.
Converts the given cubemap coordinates to longitude/latitude coordinates.
FromProjection
Computes a LatLon value by projecting the given rectangular map coordinates to cubemap coordinates.
FromRadians
2 overloads
Creates a new instance of LatLon from the given angles.
- See also
Creates a new instance of LatLon from the given angles.
- See also
FromString
2 overloads
Creates a LatLon value from the given string representation.
- ValidatingException
-
If the given input string is invalid.
Creates a LatLon value from the given string representation.
Public / Methods
Add
2 overloads
Adds the given longitude/latitude values to this LatLon value.
Adds the given longitude/latitude values to this LatLon value.
ClampLatitude
2 overloads
Clamps the latitude to the given range.
Clamps the latitude to the given range: [a in..b in] resp. [b in..a in].
FromSexagesimal
Converts the given angle in sexagesimal DMS (degree-minute-second) notation into a value in decimal degrees.
Sexagesimal DMS is a pseudo unit (EPSG 9110) and is specified as a decimal pseudo number, where the decimal digits must be interpreted in a special way:
123.456789... \_____/ seconds (1/60th minute) \/ minutes (1/60th degree) \_/ degrees
- See also
NiceStepFind
Returns a nice-looking angle value that is similar to the given angle in value.
A nice-looking angle value sums up without creating big fractions, i.e. degrees are always a divisor of 360, minutes and seconds are always a divisor of 60 and milliseconds are always a divisor of 1000:
-
Milliseconds:
[0..3] : 0°00'00.001", 0°00'00.002", 0°00'00.004", 0°00'00.005",
[4..7] : 0°00'00.008", 0°00'00.010", 0°00'00.020", 0°00'00.025",
[8..11] : 0°00'00.040", 0°00'00.050", 0°00'00.100", 0°00'00.125",
[12..14] : 0°00'00.200", 0°00'00.250", 0°00'00.500" -
Seconds:
[15..18] : 0°00'01", 0°00'02", 0°00'03", 0°00'04",
[19..22] : 0°00'05", 0°00'06", 0°00'10", 0°00'12",
[23..25] : 0°00'15", 0°00'20", 0°00'30" -
Minutes:
[26..29] : 0°01', 0°02', 0°03', 0°04',
[30..33] : 0°05', 0°06', 0°10', 0°12',
[34..36] : 0°15', 0°20', 0°30' -
Degrees:
[37..44] : 1°, 2°, 3°, 4°, 5°, 6°, 8°, 9°,
[45..51] : 10°, 12°, 15°, 18°, 20°, 24°, 30°,
[52..57] : 36°, 40°, 45°, 60°, 72°, 90°,
[58..60] : 120°, 180°, 360°
By setting the divisible opt parameter to true
, the list of nice-looking angle values is reduced to this:
-
Milliseconds:
0°00'00.001", 0°00'00.005", 0°00'00.025", 0°00'00.050", 0°00'00.250", 0°00'00.500" -
Seconds:
0°00'01", 0°00'05", 0°00'15", 0°00'30" -
Minutes:
0°01', 0°05', 0°15', 0°30' -
Degrees:
1°, 5°, 15°, 30°, 60°, 120°, 360°
- See also
NiceStepGet
Returns a nice-looking angle step value.
A nice-looking angle value sums up without creating big fractions, i.e. degrees are always a divisor of 360, minutes and seconds are always a divisor of 60 and milliseconds are always a divisor of 1000:
-
Milliseconds:
0°00'00.001", 0°00'00.002", 0°00'00.004", 0°00'00.005",
0°00'00.008", 0°00'00.010", 0°00'00.020", 0°00'00.025",
0°00'00.040", 0°00'00.050", 0°00'00.100", 0°00'00.125",
0°00'00.200", 0°00'00.250", 0°00'00.500" -
Seconds:
0°00'01", 0°00'02", 0°00'03", 0°00'04",
0°00'05", 0°00'06", 0°00'10", 0°00'12",
0°00'15", 0°00'20", 0°00'30" -
Minutes:
0°01', 0°02', 0°03', 0°04',
0°05', 0°06', 0°10', 0°12',
0°15', 0°20', 0°30' -
Degrees:
1°, 2°, 3°, 4°, 5°, 6°, 8°, 9°,
10°, 12°, 15°, 18°, 20°, 24°, 30°,
36°, 40°, 45°, 60°, 72°, 90°,
120°, 180°, 360°
- See also
NiceStepRound
Rounds the given latitude resp. longitude angle to the given nice-looking step value.
- See also
Rounds this latitude/longitude tuple to the given nice-looking step value.
- See also
Normalize
Normalizes this pair of latitude/longitude values so that the longitude value lies in the range [-180..180]
and the latitude lies within [-90..90]
.
Longitude values are wrapped at the normalization range boundaries; latitude values are clamped to the range boundaries.
Sub
2 overloads
Subtracts the given longitude/latitude values from this LatLon value.
Subtracts the given longitude/latitude values from this LatLon value.
ToSexagesimal
Converts the given angle in decimal degrees into a value in sexagesimal DMS (degree-minute-second) notation.
Sexagesimal DMS is a pseudo unit (EPSG 9110) and is specified as a decimal pseudo number, where the decimal digits must be interpreted in a special way:
123.456789... \_____/ seconds (1/60th minute) \/ minutes (1/60th degree) \_/ degrees
- See also
ToString
Returns the string representation of the given latitude/longitude angle.
The string representation has the following form:
a°b'c".dX
where…
… a
, b
, c
and d
are the latitude degrees, minutes, seconds and milliseconds, X
is either N
(positive latitude), S
(negative latitude), E
(positive longitude) or W
(negative longitude).
Returns the string representation of this set of latitude/longitude coordinates.
The string representation has the following form:
a°b'c".dX e°f'g".hY
where…
… a
, b
, c
and d
are the latitude degrees, minutes, seconds and milliseconds, X
is either N
(positive latitude) or S
(negative latitude).
… e
, f
, g
and h
are the longitude degrees, minutes, seconds and milliseconds, Y
is either E
(positive longitude) or W
(negative longitude).
The parts for minutes, seconds and milliseconds are omitted if their value is zero:
12°34'56.789"N 123°45'57.891"E 12°34'56"N 123°45'57"E 12°34'N 123°45'E 12°N 123°E