GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing geographiclib.sourceforge.io — JSDoc: Module: DMS Decode/Encode angles expressed as degrees, minutes, and seconds. This module defines several constants:
Example
Methods(static) Decode(dms) → {object}Decode a DMS string. Convert a DMS string into an angle. Degrees, minutes, and seconds are indicated by the characters d, ' (single quote), " (double quote), and these components may only be given in this order. Any (but not all) components may be omitted and other symbols (e.g., the ° symbol for degrees and the unicode prime and double prime symbols for minutes and seconds) may be substituted; two single quotes can be used instead of ". The last component indicator may be omitted and is assumed to be the next smallest unit (thus 33d10 is interpreted as 33d10'). The final component may be a decimal fraction but the non-final components must be integers. Instead of using d, ', and " to indicate degrees, minutes, and seconds, : (colon) may be used to separate these components (numbers must appear before and after each colon); thus 50d30'10.3" may be written as 50:30:10.3, 5.5' may be written 0:5.5, and so on. The integer parts of the minutes and seconds components must be less than 60. A single leading sign is permitted. A hemisphere designator (N, E, W, S) may be added to the beginning or end of the string. The result is multiplied by the implied sign of the hemisphere designator (negative for S and W). In addition ind is set to DMS.LATITUDE if N or S is present, to DMS.LONGITUDE if E or W is present, and to DMS.NONE otherwise. Leading and trailing whitespace is removed from the string before processing. This routine throws an error on a malformed string. No check is performed on the range of the result. Examples of legal and illegal strings are
The decoding operation can also perform addition and subtraction
operations. If the string includes internal signs (i.e., not at
the beginning nor immediately after an initial hemisphere designator),
then the string is split immediately before such signs and each piece is
decoded according to the above rules and the results added; thus
WARNING The "exponential" notation is not recognized. Thus
Parameters:
Throws:an error if the string is illegal. Returns:r where r.val is the decoded value (degrees) and r.ind is a hemisphere designator, one of NONE, LATITUDE, LONGITUDE.
(static) DecodeAngle(angstr) → {number}Decode a DMS string interpreting it as an arc length. Parameters:
Throws:an error if the string is illegal. Returns:the arc length (degrees).
(static) DecodeAzimuth(azistr) → {number}Decode a DMS string interpreting it as an azimuth. Parameters:
Throws:an error if the string is illegal. Returns:the azimuth (degrees).
(static) DecodeLatLon(stra, strb, longfirstopt) → {object}Decode two DMS strings interpreting them as a latitude/longitude pair. Parameters:
Throws:an error if the strings are illegal. Returns:r where r.lat is the decoded latitude and r.lon is the decoded longitude (both in degrees).
(static) Encode(angle, trailing, prec, indopt, dmssepopt) → {string}Convert angle (in degrees) into a DMS string (using °, ', and "). Parameters:
Returns:the resulting string formatted as follows:
WARNING Because of implementation of JavaScript's toFixed function, this routine rounds ties away from zero. This is different from the C++ version of GeographicLib which implements the "round ties to even" rule. WARNING Angles whose magnitude is equal to or greater than 1021 are printed as a plain number in exponential notation, e.g., "1e21".
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |