Util.DMS_Degrees() Method
Converts a string in decimal (D.D) or sexagesimal (DM.M or DMS.S) format to a value in degrees (may be fractional).
Syntax
Util.DMS_Degrees(DMS)
The method syntax has these parts:
Part |
Description |
DMS (String) |
string in various formats (see remarks) |
Return (Double) |
angular value, degrees |
Remarks
The sexagesimal to real conversion methods such as this one are flexible enough to convert just about anything that resembles sexagesimal. Thee way they operate is to first separate the input string into numeric "tokens", strings consisting only of the numerals 0-9, plus and minus, and period. All other characters are considered separators. Once the input string is parsed into tokens they are converted to numerics. If there are more than three numeric tokens, only the first three are considered, the remainder are ignored. Left to right positionally, the tokens are assumed to represent units (degrees or hours), minutes, and seconds. If only two tokens are present, they are assumed to be units and minutes, and if only one token is present, it is assumed to be units. Any token can have a fractionsl part. Of course it would not be normal (for example) for both the minutes and seconds parts to have fractional parts, but it would be legal. So 00:30.5:30 would convert to 1.0 unit. Note that plain units, for example 23.128734523 are acceptable to the method.
Copyright © 2000-2016, Robert B. Denny, Mesa, AZ