Convert – Converting MapSource gdb Files to CSV with GPSBabel Without Replacing Waypoint Names

convertcsvgpsbabel

I have multiple .gdb files that I convert to CSV files using a .bat file in Windows. A simplified version is below:

FOR %%i IN (*.gdb) DO "C:\Program Files\GPSBabel\GPSBabel" -w -i gdb -f %%i -x nuketypes,routes,tracks -o csv -F %%~Ni_convertedfile.csv

This mostly works, but where waypoints in the gdb file (viewing in MapSource) have a comment as well as a waypoint name, the output CSV file replaces the waypoint name with the comment.

For example, in this gdb file there are three waypoints
enter image description here

Ideally, I want the CSV file to appear like this:

-24.20577 30.78244 0650SB
-24.20597 30.7818 0705
-24.20602 30.78173 0720

But instead, it appears like this:

-24.20577 30.78244 01-JAN-13 6:50:22
-24.20597 30.7818 01-JAN-13 7:05:12
-24.20602 30.78173 720

Only the third waypoint has the waypoint name because it has no additional comment. The leading zero is also lost, which I would ideally also like to keep in the waypoint names. Is there a way to ensure GPSbabel formats the data how I would like? Ideally with the bat file, but I'm open to any other suggestions.

Best Answer

After reaching out to the GPSBabel mailing list, I've been told the solution: converting the file to a .unicsv file rather than a csv file provides all the fields from the .gdb files in separate columns.

-o unicsv -F %%~Ni_convertedfile.unicsv

The issue with dropping leading zeros turns out to be due to Excel formatting them as numbers and removing the zeros. Opening the file in Notepad retains the leading zeros.

Related Question