Tricks and Tips

From GPSBabel

Jump to: navigation, search

Got a favorite GPSBabel recipe? Please share it here.

Contents

[edit] Unix / Mac OS Specific

[edit] gpsup

Here is Robert Lipe's (incredibly unsmart) 'gpsup' program. It knows how to interrogate the attached Garmin to see how smart it is and adjust icon settings. It will upload a GPX file (typically a pocket query in my case) and will upload a set of default waypoints that include things like my house, family, hotels where I'll be staying and such. It also merges all the inputs together, suppressing dupes while doing smart names on the GPX files but not on the ~/default.wpt. entries.

Given the number of hardcoded paths and such, it's offered more as an example than to be immediately useful to a number of people.

:
# Strain of gpsup for uploading to Garmin USB.

#GB=~/src/gpsbabel.sp/gpsbabel
#[ -x ~/src/gpsbabel.sp/linux/gpsbabel ] && GB=~/src/gpsbabel.sp/linux/gpsbabel
GB=~/src/gpsbabel/gpsbabel

if [ `basename $0` = "gspup" ];
then
        TTY=usb:
else
        TTY=/dev/ttyS0
fi

for i in $*
do
        CMD="$CMD -i gpx -f \"$i\""
done

CMD="$CMD -i gpsutil -f /home/robertl/extra.wpt"

${GB} -i garmin -f usb:-1 | while read unit junk junk model
do
        THIS_TTY=usb:$unit
        echo Sending to $model

        case "$model" in
          StreetPilot*)  
                ICON=",deficon=Water\ Hydrant"
#               SMART=-N
                ;;
          *60C*) 
                ICON=,deficon=geocache
                SMART=-Sn
                ;;
        esac

        ${GB} -i gpsutil -f ~/default.wpt -vS -o garmin -F ${THIS_TTY}
        eval  ${GB} -w -r $CMD ${SMART} -x duplicate,shortname -vS -s -o garmin${ICON} -F usb:$unit

#       eval
done

[edit] Transferring Routes From Google Earth to GPS

Google Earth has the ability to generate routes but limited capability to transfer them to a GPS unit, in my case a Garmin eMap. GPSBabel to the rescue:

  • Get directions from GoogleEarth
  • Save the waypoints of the route as a kml file
  • gpsbabel -r -i kml -f waypoints.kml -x transform,rte=wpt -o garmin -F /GPS/Serial/Port


[edit] Windows Specific

[edit] Garmin center

Here is Jim Shilt's amazingly unsmart batch file Garmincenter.bat I travel constantly and this batch file will get the position of my attached Garmin gps and upload the nearest 980 locations from a pre combined file that contains my home, kids' home, pharmacy locations, restaurants I have seen on Food Network, interesting locations from Roadside visions etc.

gpsbabel -i garmin,get_posn -f usb: -o xcsv,style=currentlocation.style -F location.txt 
FOR /F "tokens=2" %%i in (location.txt) DO set lat=%%i
FOR /F "tokens=4" %%i in (location.txt) DO SET lon=%%i
ECHO Uploading to GPS.... 
 gpsbabel -vs -w -N -i gpx -f unfound.gpx -x radius,distance=5000M,maxcount=980,lat=%lat%,lon=%lon% -o garmin -F usb: 

The currentlocation.style file contains the following.

FIELD_DELIMITER SPACE
RECORD_DELIMITER NEWLINE

IFIELD CONSTANT, "Latitude","%s"
IFIELD LAT_DECIMAL, "", " %f"
IFIELD CONSTANT, "Longitude","%s"
IFIELD LON_DECIMAL, "", " %f"

[edit] External Links

Personal tools