GPS On Linux

I have bought myself a GPS Receiver BU-353. Having plugged in the device into my Debian Wheezy workstation, I wanted to test that it was working.

A quick dmesg | tail showed me that the device has been found and installed correctly (no drivers required).

I then installed the GPS daemon:

$ sudo apt-get install gpsd gpsd-clients
$ sudo dpkg-reconfigure gpsd

This then started the GPS daemon. The next thing to do was get some example output, and the tool for this is gpspipe:

$ gpspipe -w -n 5

Lastly, I thought it would be fun to plot the output onto Google Maps and/or Openstreetmaps:

$ tpv=$(gpspipe -w -n 5 | grep -m 1 TPV | cut -d, -f4,6-8,13)
$ latitude=$(echo $tpv | cut -d, -f3 | cut -d: -f2)
$ longitude=$(echo $tpv | cut -d, -f4 | cut -d: -f2)
$ google_map_url="http://maps.google.com/?q=${longitude},${latitude}&z=${zoom}"
$ osm_map_url="http://www.openstreetmap.org/?mlat=${latitude}&mlon=${longitude}&zoom=${zoom}&layers=M"
$ xdg-open $google_map_url
$ xdg-open $osm_map_url

All worked beautifully.

comments powered by Disqus