This python script is now over 4 years old. `gpsd` has moved on. The original implementation of WILL NOT WORK with versions of `gpsd` greater than v2.90.

Thanks to encouragement from Claude Frantz, I have been able to convert the connection and API call to the current version of `gpsd` - GPSD-NG. The updated program has had a suffix added to its name.
Be aware that 'v3' should also work with all gpsd versions > v2.91.
At least, the calculations haven't needed to change!

'OGY 20120218

This project stems from a frustration in needing a linux-based program to display my whereabouts in Maidenhead LOCATOR (Grid Square) terms. What I have ended up with is a universal [cough, cough] GPS-data-to-Lat/Long-to-Locator program that will run on Windows®, linux, MacOS®, Crays - even your Nokia cell phone!

With a couple of provisos: to have a recent version ( >v2.5 <3.x) of the "Python" programming language installed and...

... there is a software suite available to run on Linux machines (like my old Dell laptops with Ubuntu linux installed) called `gpsd'. It stands for "GPS Daemon". That's not a devil-in-disguise but a 'server' program that runs in the background - like a web server does.

This one connects and talks to your GPS receiver in the most efficient 'GPS-speak' it can negotiate and makes the GPS data available to other programs using a standardised message format. The extremely clever folks at the `gpsd' project have done all the hard work.

`gpsd' will talk to Garmins, SiRF-Star boards, Motorola devices, et cetera in their "own language" and then push this information out to other software in a sort of GPS-esperanto that is much less ambiguous than NMEA.

The `gpsdll2mh' program connects to a gpsd daemon running on the same computer, or on another machine accessible over a network, and prints out the location of the GPS device as both Latitude/Longitude and LOCATOR; every so-many seconds.

So, in a 'rover' contest or on a WAB trip, the radio operator will know immediately when the vehicle has transited from one (small) square to another.

Presently, gpsdll2mh runs in a Command Prompt or Terminal. I once had a mind to convert it into a window-ed application with Tk but with the Terminal/Command Prompt tricks you can do - using the Zoom function of a Gnome/Ubiquity (linux) terminal window you can grow the text adequately or on a windows system, the Properties of the Command Prompt `DOS box' can be changed to use a BIG typeface size (say, 36 pixels high) - it really is not necessary.

As I mentioned before, the program isn't fully finished - even having just updated it (Feb 2012) to cope with the `gpsd` API change - I'd like to finish the necessary branch to (optionally) untie it from `gpsd's coat-tails (so that Lat & Long could be entered manually, derived from another source). But right now it does what I set out to do so it may as well be exposed to a bit more peer review.

That said, I can't take all the credit for the program because I copied the LOCATOR calculation part from lonlat2maidenhead a python script that I found when looking for a linux replacement for the Windows® program, TAC32 that I had used in the past.

So that's my excuse: here are download links for version corresponding to the point where `gpsd` changes API: < v2.90 and after > v2.91. The zip files contain but if you are not prepared to sully your machine downloading the zips you'll find a link to the text below.
(If you copy from the web page, remember it is crucial to maintain the indentation of the various code blocks.)
All parts of the code are licenced under the GNU GPL - but please credit (and advise) the authors if you use this code in your own programs.

last updated: 20090511 last updated: 20120218