[MAP1 PIC] Chapter 34.   GPS Mapping and Geotagged Images


[ This chapter does not appear in the book. ]

GPS chips are becoming standard in smart phones, but what about adding similar functionality to laptops, netbooks, and other mobile PCs? GPS receivers that connect to devices via a USB port aren't particularly expensive (US$30 for a decent one), and are surprisingly easy to utilize from Java.

The first part of this chapter describes my experience using the Canmore GT-730F USB GPS receiver for obtaining latitude and longitude information to display on a map downloaded from OpenStreetMap. The image at the top of this page shows a map of the road outside my office building, created as I walked around with the GPS receiver plugged into my netbook.

My position is shown by a yellow circle in the center of the map. As I moved about, the map was updated dynamically so the yellow circle stayed centered in the window. The next picture down shows my location a little later, after I've walked down the street.


The map rendering, including dynamic updating, is easy; all the heavy lifting is done by the JMapViewer Swing component which manages the integration between Java and OpenStreetMap. JMapViewer also supports zoom controls, mouse dragging of the map, client-side map caches, and different map sources.

The application's GPS processing is handled by the gpsinput package from GPSylon, although the GPS data is so simple that it can be processed directly with the Java Communications API. I'll start by showing how to use the RXTX API (a near-compatible alternative to the Java Communications API) to treat the GPS receiver as a serial port input stream.

This chapter includes three other GPS-related applications:




Dr. Andrew Davison
E-mail: ad@fivedots.coe.psu.ac.th
Back to my home page