bobclark
10-14-2008, 08:23 AM
X-Plane(x-plane.org) has an option to export real time data. I set it up to write the lat/long to a file (Data.txt) on disk. Then with the following script I reformated the data and fed it to gpsbabel. The output from gpsbabel is a kml file writen to my web directory on my mac. From another computer i added a network link to google earth (http://192.168.1.102/~Username/xplane-data.kml). The link is set to refresh and zoom every 3 seconds. Now the second computer tracks my flight in google earth in real time.
#!/bin/bash
cd /Applications/X-Plane\ 9/
while [ 1 ]; do
tail -n 5 Data.txt | head -3 | tail -n 1 | awk -F '|' '{ gsub(/ */,"",$1);gsub(/ */,"",$2); print $1 "," $2 }' | gpsbabel -i csv -f - -o kml -F ~/Sites/xplane-data.kml
sleep 3
done
Seeing that it is 3am. i'm going to " sleep 10800 ". I had to stay up to make my first X-Plane carrier landing. I expect to look as rough as the landing was. It will probably take as many attempts to wake up too. :)
#!/bin/bash
cd /Applications/X-Plane\ 9/
while [ 1 ]; do
tail -n 5 Data.txt | head -3 | tail -n 1 | awk -F '|' '{ gsub(/ */,"",$1);gsub(/ */,"",$2); print $1 "," $2 }' | gpsbabel -i csv -f - -o kml -F ~/Sites/xplane-data.kml
sleep 3
done
Seeing that it is 3am. i'm going to " sleep 10800 ". I had to stay up to make my first X-Plane carrier landing. I expect to look as rough as the landing was. It will probably take as many attempts to wake up too. :)