latLonToString()
The function converts float coordinates into string coordinates.
Synopsis
string latLonToString(float lat, float lon, string notation = \”DMS\”,int precision = -1)
Parameter
Parameter | Description |
---|---|
lat | Latitude |
lon | Longitude |
notation | Type of notation that is used. |
precision | Number of digits in addition to the base degree value |
Description
The function converts the stated float coordinates into a string. Within the string language specific characters represent North or South respectively East or West additionally to the degree values.
Multiple notations can be used:
- "Decimal" - The coordinate values are shown as degrees containing a fractional part, e.g. "47.45655°N, 16.23423°E"
- "DM" - Coordinate values are shown as degrees and minutes, e.g.: "47° 27.393’N, 16° 14.054’E"
- "DMS" - Coordinate values are shown as degrees, minutes and seconds, e.g.: "47° 27’ 23.6”N, 16° 14’ 03.2”E"
The precision parameter specifies the number of digits that are used in addition to the degree value. Depending on the notation, all these digits are used after the degree decimal point (Decimal), used for minutes alone (DM) or distributed between minutes and degrees (DMS). All examples above have a precision parameter of five.
Assignment
See also