Maidenhead Locator System - Hardware and Software Support

Hardware and Software Support

In 1985 the Radio Society of Great Britain published a small set of BASIC language routines to convert from locator references to geographical coordinates (latitude and longitude) for further processing. A complete program in BASIC called Universal Gridlocator was made available next year by ARRL for a nominal cost of US $3. Many other utilities exist to convert latitude and longitude to locators, as this is a favorite hack for programmers who are also radio amateurs. Perl supports conversion between geographical coordinates and Maidenhead locators in module Ham::Locator by Andy Smith, available on CPAN.

Many commercially available general purpose (civil) Global Positioning System (GPS) receivers (e.g. Garmin GPS-12) have the option to display directly the position in Maidenhead Locator format.

The following small script in perl, converts geographical coordinates to 6-character Maidenhead locators, without error checking:

#!/usr/bin/perl -w # (c) 2012 Chris Ruvolo. Licensed under a 2-clause BSD license. if($#ARGV < 1){ printf("Usage: $0 \n"); exit(1); } my $lat = $ARGV; my $lon = $ARGV; my $grid = ""; $lon = $lon + 180; $lat = $lat + 90; $grid .= chr(ord('A') + int($lon / 20)); $grid .= chr(ord('A') + int($lat / 10)); $grid .= chr(ord('0') + int(($lon % 20)/2)); $grid .= chr(ord('0') + int(($lat % 10)/1)); $grid .= chr(ord('a') + int(($lon - (int($lon/2)*2)) / (5/60))); $grid .= chr(ord('a') + int(($lat - (int($lat/1)*1)) / (2.5/60))); print "$grid\n";

And code for making the reverse calculation:

#!/usr/bin/perl -w # (c) 2012 Chris Ruvolo. Licensed under a 2-clause BSD license. if($#ARGV < 0){ printf("Usage: $0 \n"); exit(1); } my @grid = split (//, uc($ARGV)); my $lon; my $lat; $lon = ((ord($grid) - ord('A')) * 20) - 180; $lat = ((ord($grid) - ord('A')) * 10) - 90; $lon += ((ord($grid) - ord('0')) * 2); $lat += ((ord($grid) - ord('0')) * 1); my $formatter; if ($#grid >= 5) { # have subsquares $lon += ((ord($grid)) - ord('A')) * (5/60); $lat += ((ord($grid)) - ord('A')) * (2.5/60); # move to center of subsquare $lon += (2.5/60); $lat += (1.25/60); # not too precise $formatter = "%.5f"; } else { # move to center of square $lon += 1; $lat += 0.5; # even less precise $formatter = "%.1f"; } $lat = sprintf($formatter, $lat); $lon = sprintf($formatter, $lon); print "$lat $lon\n";

Read more about this topic:  Maidenhead Locator System

Famous quotes containing the words hardware and/or support:

    A friend of mine spoke of books that are dedicated like this: “To my wife, by whose helpful criticism ...” and so on. He said the dedication should really read: “To my wife. If it had not been for her continual criticism and persistent nagging doubt as to my ability, this book would have appeared in Harper’s instead of The Hardware Age.”
    Brenda Ueland (1891–1985)

    [They] hired a large house as a receptacle for gentlewomen, who either had no fortunes, or so little that it would not support them. For these they made the most comfortable institution [and] provided [them] with all conveniences for rural amusements, a library, musical instruments, and implements for various works.
    Sarah Fielding (1710–1768)