Talk:NMEA

From OpenStreetMap Wiki
Jump to navigation Jump to search
#!/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.gz" ]; then
      echo "$file.gpx.gz already exists. Skipping convert"
    else
      echo "$file.gpx - converting"
      gpsbabel -i nmea -f $file -o gpx -F "$file.gpx"
      echo "$file.gpx.gz - compressing"
      gzip "$file.gpx"
    fi
  fi
done


The above script is a modification on the main page which needs refinement. It is for use with a new patch for JOSM to allow the opening of .gpx.gz file. The modification of the script allow for the auto compression of the gpx files. Smsm1 00:10, 11 May 2007 (BST)

BASH script with support for spaces in filenames

Having upgraded to the latest NaviGPS firmware (1.61) I discovered it now puts spaces in filenames, which caused this script to trip as 'for' works only on space separated values. Solution based on original script below. Note the different argument that has to be passed to it. Higgy

#!/bin/bash
if [ -z $1 ] ; then
echo "Opens all NMEA files in a directory and converts to GPX."
echo  "usage: ./gpxconvert <nmea_input_dir>"
exit 0
fi
export IFS=$'\n'
find $1 -type f -iname '*.TXT' | while read file
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

Dead Link

The link in the section "Uploading NMEA text dumps (web interface)" is defect. It should be changed or deleted. Fabiando (talk) 21:46, 27 January 2018 (UTC)