Wednesday 14 November 2018

Coordinates (1): variety of coordinate formats

A glance at variety of coordinate formats which you can find in aeronautical publications (AIP, NOTAMS, other documents) might give you a serious headache:
  • Poland: 520932.8N 0205905.6E
  • Senegal: 14DEG40'30''N 017DEG25'59''W
  • India: 130000N 0781015E
  • Australia: 12 25 24S 130 54 23E, S 18 16 31.28 E 143 35 19.30, S24 00.0 E152 12.5
  • USA: 30 15 01.00N 088 04 45.00W, lat. 38°38'19"N., long. 104°52'02"W
  • Pacific Organised Track System (PACOTS): 41N160E 44N170E
are among the most common ones.


As you can see, a good system should be able to do with coordinate:
  • process coordinate input in various formats
  • check if input is valid (e. g. 911547N is not valid)
  • convert input into decimal degrees format (which is used 'directly' by computers)
  • convert it into a format that used in system as a default (e. g. convert from 521547N into 52 15 47.00N)
  • convert it from decimal degrees format into degrees, minutes and seconds format - which is more human friendly
To summarize, we can distinguish following coordinate formats:
 (where D – Degrees, M – minutes, S – seconds, H – hemisphere letter N, S, E, W)
  • DD: signed decimal degrees, no hemisphere letter (+, -, or no sign)
  • HDD, DDH: decimal degrees with hemisphere letter prefix and suffix
  • DM, HDM, DMH: degrees, minutes signed, hemisphere letter prefix and suffix
  • DMS, HDMS, DMSH: degrees, minutes, seconds signed, hemisphere letter prefix and suffix
DM, DMS formats (and variations) can be:
  • ‘compacted’: 521547N
  • ‘separated’ or ‘delimited’, where separator or delimiter can be space, hyphen, letter ‘d’, ‘D’, word ‘deg’, or degree, minutes and seconds symbols (°, ', ").
I will show you how to approach that problem in two ways.
We can write regular expressions for coordinates format, and check if input match that expression,
or we can write a parser that will analyze input to check if input is or is not  a valid latitude or longitude.

 

No comments:

Post a Comment