[OSM-talk] Batch conversion of NMEA files

Nick Hill nick at nickhill.co.uk
Thu Nov 9 14:16:05 GMT 2006


I have written a very simple bash script which may be useful for those with many 
NMEA files to convert into GPX. For example, if you turn  your navigps on and 
off regularly.

Save it as gpxconvert then run it as ./gpxconvert nmeafile1 or if you have more 
than one to convert, ./gpxconvert nmeafile1 nmeafile2 or even ./gpxconvert *.nmea

#!/bin/bash
if [ -z $1 ] ; then
echo "Takes a list of inout NMEA files, converts to GPX files."
echo  "usage: ./gpxconvert <nmea_input_files>"
exit 0
fi
for file in $@; do
if [ ! -e $file ]; then
  echo "$file input file doesn't exist, Skipping."
else
  if [ -e "$file.gpx" ]; then
  echo "$file.gpx already exists. Skipping"
  else
   echo "$file.gpx - converting"
   gpsbabel -i nmea -f $file -o gpx -F "$file.gpx"
  fi
fi
done

The script will skip files where the output file already exists. If you have a 
folder where you upload your nmea files, you can just drag your new nmea files 
into the folder then run ./gpxconvert *.nmea (assuming .nmea is your file 
extension). It will only convert those which haven't yet been converted.

If you use windows, you will need to install cygwin to run the bash script.

http://www.cygwin.com/




More information about the talk mailing list