Friday, March 02, 2007

GPSylon: Tracking Open Source

Looking for a way to read from a serial port from Java code I ran into RxTx, an OSS library that provides native support for Windows, Linux, Sun and Mac.

RxTx is used by GPSylon, an OSS project headed by Christof Dallermassl that reads data from a GPS receiver and displays its current position on a moving map with data obtained from Expedia servers.

GPSylon supports several Garmin models, NMEA log files, output from the gpsd daemon and connections from a serial port.

You can import/export tracks to/from GPX formated files. Location marks (waypoints) that can also be imported/exported are stored in a HyperSonic Java database by default. Directions are provided for use of MySql for larger datasets for better performance.

Installing

The project source and binaries are hosted by SourceForge. To run GPSylon you need Java JRE/JDK version 1.4 or greater (it doesn't support 1.3).

For Windows XP copy the native DLL located at \gpsylon_bin-0.5.2\lib\native\Windows XP\x86\rxtxSerial.dll to a directory listed in your PATH environment variable. The easiest (but not the cleanest) way is to copy it to \Windows\System32.

Running

With Java installed and accessible from a command-line window go to the directory you extracted GPSylon and run the following command:

java -jar gpsylon-0.5.2.jar

At the first run you will be asked about creating a new database and support files to keep track of map downloads.

Moving Map

I tried it with a Bluetooth receiver through a serial connection. Set the COM port under File | Preferences | GPS Device. Apply the changes, close the app and relaunch it. Under Layers, check the "Position layer".

Now under GPS check "Follow me" and "Automatic Map Download". If GPSylon can read good data from your receiver you should be able to see a map of the region. Zooming in will work up to a point. Moving around will leave "bread crumbs" by default. You can control colors and intervals from the Preferences dialog.

If you loose connection with the receiver you might need to restart the process all over, it seems that getting Java and native code to stay in sync requires a bit of work. You can check the raw NMEA data from GPSTool | View GPS Raw Data.

In fact, GPSTool can be used as a command-line tool to read data from a GPS receiver (and NMEA log files). You can also load tracks generated with GPSDrive, another open-source project.

According to its documentation GPSylon uses the OpenMap framework (in particular its MapBean class). It provides a plugin architecture so it can be extended to provide extra features. Its current version includes plugins for altitude tracking, map data management, XML data import from Kismet (wi-fi sniffer) and average position calculation.

If you want to get your hands dirty with some Java code and Open Source this is a great place to start.

No comments: