This post explains how to log GPS data from a BerryGPS or a BerryGPS-IMU and then how to plot this data onto Google Maps and many other maps E.g. OpenStreet, WorldStreet, National Maps, etc..
1. Setup GPS
Follow the instructions on this page to setup your Raspberry Pi for a BerryGPS-IMU. Ensure GPSD is set to automatically start and confirm that you can see the NMEA sentences when using gpsipe;
2. Automatically Capture Data on Boot.
We will be using gpspipe to capture the NMEA sentence from the BerryGPS and storing these into a file. The command to use is;
-r = Output raw NMEA sentences.
-d = Causes gpspipe to run as a daemon.
-l = Causes gpspipe to sleep for ten seconds before attempting to connect to gpsd.
-o = Output to file.
The date the file is created is also added to the name.
Now we need to force the above command to run at boot. This can be done by editing the rc.local file.
Just before the last line, which will be ‘exit 0’, paste in the below line;
gpspipe -r -d -l -o /home/pi/`date +"%Y%m%d-%H-%M-%S"`.nmea
Reboot and confirm that you can see a .nmea file in the home directory.
Every time the Raspberry Pi is rebooted, a new file will be created.
3. Collect Some Data
Go and collect some data. For this post, I used a BerryGPS sitting on a Raspberry Pi Zero and I placed it on the dashboard of my car.
I was able to confirm that the GPS had a fix by the flashing fix LED.
4. Plot the Data
We will use www.gpsvisualizer.com to plot the route we collected.
www.gpsvisualizer.com will accept the raw NMEA file.
Its best to use this page as you will be able to configure a number of options before you upload;
http://www.gpsvisualizer.com/map_input
Below is an example route I took;
5. Change Track Data
GPS Visualizer can colorize your tracks according to speed, elevation, or some other unit.
This can be done by selecting the value in the drop down box highlighted below;

Here are two examples, speed and number of satellites;


6. Display the Route in Google Earth
www.gpsvisualizer.com can also be used to convert your raw NMEA file into a GPX file which then can be used with Google Earth.
Use this URL;
http://www.gpsvisualizer.com/convert_input?convert_format=gpx
Upload you file, make sure GPX is selected and then click the convert bottom. Once converted, download the GPX file and open it in Google Earth.
To show the elevation and speed profile of your route within Google Earth, right click the track and select ‘Show Elevation Profile’

[wp_ad_camp_1]
Extremely helpful instructions. Thanks for sharing them! I’m well on my way to mapping now! Well done!!
In order to automatically capture data on boot I had to add the ‘sleep 60’ line and additional blank lines in the /etc/rc.local.
fi
# Line purposefully left blank
sleep 60
gpspipe -r -d -l -o /home/pi/`date +”%Y%m%d-%H-%M-%S”`.nmea
# Line purposefully left blank
exit 0
This worked for me using GPS Timing Antenna + 10 Meter Cable SMA, HAB-GPSPI-NAN, and Raspberry Pi 3.
I have found that the device only begins automatically when I am connected to my home wifi. It will not connect when there is no wifi or I am connected to my mobile hotspot. I can manually start it via SSH. Does anyone have a solution or where this problem might be originating from?
Isn’t there a cpp program (just like berryIMU) that can get GPS data and print it out?
I don’t want to record it. I need to know the latitude, longitude and altitude
Hi there,
This has exactly what I’m looking for… I want to track flights in a light aircraft.
The one thing I would like to see (optional extra?) is a gsm module so I can have the flight data sent home automatically without having to be there.
What are the chances of such a thing happening? If not, would an existing gsm module be able to live together on the same Pi? Sorry I’m not much of a hardware guy!
Cheers,
Stuart