04 May 2010

GPS: gpsd and google earth ?

how to use a gps with google earth on unix (ubuntu) ?

first we need gpsd: http://gpsd.berlios.de/
start the gps: gpsd -N -n -D 2 /dev/ttyUSB1
good tools to undertsand gpsd and your gps are:
gpsprof -f cycle (synchro)
xgps (check if it works)
gpsmon (display what the gps return - sirf or nmea (start a line with $GPRMC) - or change the config of the gps)

My gps does not return NMEA data but SiRF
(try to change to nmea with gpsctl -n)

so, I had to create fake/virtual serial port and use gpspipe to translate SiRF to NMEA.
Socat does the job and even better, you can execute a command to redirect in the serial port:

sudo apt-get install socat
socat -d -d pty,raw,echo=0 "exec:gpspipe -r,pty,raw,echo=0"
> it will give you the name of the port, example: /dev/pts/6

Then I have used a python script GEgpsd to read NMEA data and update a kml file:
http://www2.warwick.ac.uk/fac/sci/csc/people/computingstaff/jaroslaw_zachwieja/gegpsd/

You can then open a kml file with googleearth, where the file generated by GEgpsd is linked and says to be refreshed.

That's it .. thanks for this awesome free tools.