David
Sizemore
menu

Generating Google Maps files from GPS data

| 0 comments

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.

Leave a Reply

Required fields are marked *.