Sunday October 26, 2008
Generating Google Maps files from GPS data - Part 2 | 10:26 am | Comment
I previously discussed my method for generating Google Maps files with a single click. Since then I have made some modifications to my GPSBabel XCSV style file. The best way to highlight these changes is to view a sample map generated with this process.

Some of the changes include:

  • Date and time for start and end points for each day

  • Altitude for start and end points for each day

  • Maximum () and minimum () altitude for each day

  • Distance traveled in a given day - shown in the end marker balloon

  • Total trip distance traveled for all days - shown in info panel

  • Button to show/hide the track lines - in case you want to see the name of a road, for example

  • Button to show/hide an info panel in the lower right corner with total trip distance and coordinates of mouse/last click

Initially, the Google Maps HTML files I was getting from multi-day tracks were way too big and were basically grinding my browser to a halt. I used the GPSBabel simplify filter to remove extra data points which greatly reduced the resulting file size and increased performance significantly. The filter was applied as shown below:

gpsbabel.exe -i gpx -f infile.gpx -x simplify,crosstrack,error=3.0m -o xcsv,style=google_maps.style -F outfile.html

Finding the total distance across multiple days ended up being a lot easier than I expected, thanks to a function in the Google Maps API, which resulted in this code:

var total_miles = 0;
var miles = poly[z].getLength() * 0.000621371192;
total_miles = total_miles + miles;

All of the changes are available in the updated zip file available here. I'm having additional discussions about this GPS datalogger and my workflow over on the GpsPasSion forums (starting on page two).
Tuesday October 7, 2008
Generating Google Maps files from GPS data | 12:29 am | Comment
After a trip I like to generate a Google Maps file showing the track I took during that trip. In the past this could be a tedious process, as it required me to run my GPX file that I generate with GPSBabel through yet another application (DGManager.NET), and even then, there was some HTML editing required to get things just right.

I finally automated the process with the help of trusty GPSBabel, their XCSV style files, and some JavaScript. The hard part stemmed from the fact that GPSBabel does not have a way to pass the GPX 'bounds' element into the HTML file. This data is important to define the boundaries of the Google Map and the appropriate zoom level for your data. I finally wrote some JavaScript that handles this. My XCSV file can be downloaded here and used with your own Google Maps API key (see the comments in the file for the correct location).

I added the following line to my original batch script to create the Google Maps file in addition to the GPX file:

"C:\Program Files\GPSbabel\gpsbabel.exe" -i gpx -f ..\%OUTPUT_FILENAME%.gpx -o xcsv,style="C:\Program Files\GPSbabel\google_maps.style" -F ..\%OUTPUT_FILENAME%.html

With this updated script, I now have a very short workflow to take a bunch of NMEA input files and create an optimized GPX file and corresponding Google Maps HTML file for posting online.
Monday October 6, 2008
Gas Mileage Log | 11:15 pm | Suggestions?
I originally saw a good gas mileage calculator on another website a while back. Once I used it for a time or two I realized I could get a lot more information out of a few data points recorded at each fill up. I created a modified version of their file that will give you all sorts of information about your gas mileage. Download the MS Excel Document here.

Delete my sample data before you start (the data in white cells). You need to enter an initial odometer reading in B2, then continue with gas fill-ups in the white cells. Everything in light blue is automatically calculated.

On the right hand side you can enter a distance (P3) to estimate how much a given trip will cost based on your average calculated cost per mile. You also need to enter the dates of your last Oil Change, Tire Rotation, and State Inspection in S2, T2, and U2. I have had a few issues with the scales on the graphs' Y-axis, so you may have to tweak those to fit your data. Everything else should be automatic!
Thursday September 25, 2008
Geotagging Workflow | 9:45 pm | Comment
I have recently switched GPS data loggers from my trusty GlobalSat DG-100 to a Locosys BGT-31. The main reason for the switch was so that I could use external memory cards to store the data on long trips. I am very impressed with the BGT-31, but it isn't without its challenges. The main issue I have with it is that it either creates a binary file that you must read with their software, or you get NMEA text files. In order to minimize losses in the event of file corruption, I keep the log files to a maximum of 128KB. This can result in many files over the course of a long trip.

In order to geotag my photos from a trip I prefer to use GPicSync, which is easier to use with a single GPX input file. In order to create that single GPX file from the many individual NMEA text files, I use GPSBabel. GPSBabel is great, but there is no native way that I have found to easily select a bunch of input files from the command line, so I wanted something to automate it for me. I finally gave up finding an existing tool to do this, so I wrote a little batch script to do it for me. You can download a zip file containing the script here. Basically, here's how I use it:

Place the batch file into your GPSbabel directory (I assumed C:\Program Files\GPSbabel\). Add the registry key to your registry at "HKEY_CLASSES_ROOT\Folder\shell\Process GPS Files\command." You will now have a right-click context menu option titled "Process GPS Files" when you right-click on a folder. Right-click on the folder containing your NMEA GPS files, select the "Process GPS Files" menu option, enter your desired output filename, and hit enter. This will produce a GPX file in the parent directory of the folder you selected. Use the GPX file as input into GPicSync, and as a single backup file. You can also use the GPX file to create Google Earth KML files, or Google Maps files.
Wednesday September 24, 2008
I'm Back! | 11:05 pm | Comment (2)
Hello world?
Generated in 0.004353 seconds.