Maidenhead grid -- longitude / latitude calculator not limited to 6 characters

The Maidenhead Locator System is a grid system used by amateur radio operators. I crudely implemented a Maidenhead grid to longitude/latitude calculator, not limited to the 6 characters as often seen with other programs. Written in a one-time python spree here on Debian GNU/Linux. Download: lonlat2maiden, maiden2lonlat. See my notes, Kanters' 2004, G1OGY's 2008 augmentations.

First, in case you use DMS notation, convert it into decimal degrees,

$ set 120d51\'57.74\"E 24d10\'54.14\"N ; echo $@

120d51'57.74"E 24d10'54.14"N

$ set $(echo $@ | cs2cs +proj=latlong -f %.8f) ; echo $1 $2

120.86603889 24.18170556

Now we are ready to go,

$ echo $1 $2 | lonlat2maiden

PL04KE

#arbitrarily picking 22:

$ echo $1 $2 | lonlat2maiden 22

PL04KE33WO16WF07TP38UR

$ echo $1 $2 | lonlat2maiden 22 | maiden2lonlat

120.86603889 24.18170556

$ echo $1 $2 | lonlat2maiden 22 | maiden2lonlat | cs2cs +proj=latlong

120d51'57.74"E 24d10'54.14"N 0.000

By the way, as to just how many digits one needs for what granularity, we examine what the smallest length one can distinguish with the latitude parameter as we increase string length:

Len      meters example
 2 1111200.0000 PL
 4  111120.0000 PL04
 6    4630.0000 PL04KE
 8     463.0000 PL04KE33
10 19.2917 PL04KE33WO
12  1.9292 PL04KE33WO16
14  0.0804 PL04KE33WO16WE
16  0.0080 PL04KE33WO16WE57
18  0.0003 PL04KE33WO16WE57NA

So, to dazzle your friends with millimeter precision, one need not make one's vanity Maidenhead locator too long after all. (Code used to make above output)

Hmmm, the Maidenhead system is sort of like Taiwan Power Company grids.


Dan Jacobson

Last modified: 2015-02-15 08:57:21 +0800