Dave, > What I'm wanting to do is grab a string of characters from a GPS (.loc > - xml?) > file and use that string to rename that file from the generic name to > the specific waypoint name, convert it to .gpx & upload it > > I've been doing a power-of-googling tonight but I haven't got it to work yet > > here are the manual steps I'm currently using (which work): > > 1. download .loc file to /tmp > > 2. open the .loc file and manually, copy the waypoint name then paste it > into the following code (convert the Geocaching .loc file to .gpx > format, then delete the .loc file): > > 3. Code: gpsbabel -i geo -f /tmp/geocaching.loc -o gpx -F > ~/<insert-Geocache-name>.gpx & rm /tmp/geocaching.loc
Try this: NAME=`grep "name id=" /tmp/geocaching.loc | cut -d "\"" -f 2` gpsbabel -i geo -f /tmp/geocaching.loc -o gpx -F > ~/$NAME.gpx & rm /tmp/geocaching.loc > > 4. finally upload the waypoint to the GPS: > > 5. Code: gpsbabel -w -i gpx -f <insert-Geocache-name>.gpx -o garmin > -F /dev/ttyS0 gpsbabel -w -i gpx -f $NAME.gpx -o garmin -F /dev/ttyS0 > It works quite well but isn't very elegant I'm afraid > > Heres a sample of a .loc file: > > <?xml version="1.0" encoding="UTF-8"?> > <loc version="1.0" src="Groundspeak"> > <waypoint> > <name id="GCW0FP"><![CDATA[Tasty Baking (Canterbury) by > BuckoBoys]]></name> > <coord lat="-43.***" lon="172.***"/> > <type>Geocache</type> > <link text="Cache > Details">http://www.geocaching.com/seek/cache_details.aspx?wp=GCW0FP</link> > </waypoint></loc> > > The bit I want out is: "GCW0FP" so I end up with the file "GCW0FP.gpx" > being uploaded (limited to 6 characters - numbers/letters all uppercase) You can add your own error checking. -- Later David Kirk
