Geocaching Log Feed Added

Since I am limited to Blogger for publishing our “My Finds” PQ, I’ve used a WordPress widget to add a link to the latest posts here.

You can find them on the Geocaching page.

Blog Your Geocaching Found Logs with Blogger

You may or may not be aware that Google have recently released a command line tool called Google CL which allows limited updating of some of it’s primary services from the command line – including Blogger.

I have been working on a script and looking for a utility to parse the “My Finds” pocket query for uploading to a blog for a while now so on hearing this news I set to work to see if I could create an automated script. You can see the results on my old blogger account, which I have now renamed _TeamFitz_ and repurposed for publishing our Geocaching adventures.

It’s a little bit clunky and could be improved, but the script is now complete and ready for ‘beta’. I’m publishing it here and releasing it under GPL for others to download, copy and modify for their own Geocaching blogs.

A few snags:

  • It will only work with one “Find” per cache – if you found twice it may screw up the parser.
  • Google have an arbitrary limit of 30-40 auto-posts per day, which is entirely fair, it will then turn on word verification which will prevent CL updates. I have limited the script to parse only 30 posts at a time.

You will need to download and install Google CL, it goes without saying the script is Linux only but if someone wants to adapt it to Windows they are welcome.

I have commented out the “google” upload line for test runs, remove # to make it active.

Either cut n’ paste the code below, or download the script from YourFileLink. Please comment and post links to your own blogs if you use it, also let me know if there are any bugs I haven’t addressed.

#!/bin/bash
# Script to unzip, parse and publish
# Pocket Queries from Geocaching.com to Blogger
# Created by Wes Fitzpatrick (http://wafitz.net)
# 30-Nov-2009. Please distribute freely under GPL.
#
# Change History
# ==============
# 24-07/2010 - Added integration with Blogger CL
#
# Notes
# =====
# Setup variables before use.
# Blogger has a limit on posts per day, if it
# exceeds this limit then word verification
# will be turned on. This script has been limited
# to parse 30 logs.
# Blogger does not accept date args from Google CL,
# consequently posts will be dated as current time.
#
# Bugs
# ====
# * Will break if more than one found log
# * Will break on undeclared "found" types
#   e.g. "Attended"
# * If the script breaks then all temporary files
#   will need to be deleted before rerunning:
#	.out
#	.tmp
#	new
#	all files in /export/pub
#####     Use entirely at your own risk!      #####
##### Do not run more than twice in 24 hours! #####
set -e
clear
PQDIR="/YOUR/PQ/ZIP/DIR"
PUBLISH="$PQDIR/export/pub"
EXPORT="$PQDIR/export"
EXCLUDES="$EXPORT/excludes.log"
GCLIST="gccodes.tmp"
LOGLIST="logs.tmp"
PQZIP=$1
PQ=`echo $PQZIP | cut -f1 -d.`
PQGPX="$PQ.gpx"
BLOG="YOUR BLOG TITLE"
USER="YOUR USER ID"
TAGS="Geocaching, Pocket Query, Found Logs"
COUNTER=30
if [ ! $PQZIP ];then
echo ""
echo "Please supply a PQ zip file!"
echo ""
exit 0
fi
if [ ! -f "$EXCLUDES" ];then
touch "$EXCLUDES"
fi
# Unzip Pocket Query
echo "Unzipping PQ..."
unzip $PQZIP
# Delete header tag
echo "		...Deleting Header"
sed -i '/My Finds Pocket Query/d' $PQGPX
sed -i 's/'"$(printf '\015')"'$//g' $PQGPX
# Create list of GC Codes for removing duplicates
echo "		...Creating list of GC Codes"
grep "<name>GC.*</name>" $PQGPX | perl -ne 'm/>([^<>]+?)<\// && print$1."\n"' >  $GCLIST
# Make individual gpx files
echo ""
echo "Splitting gpx file..."
echo "	New GC Codes:"
cat  $GCLIST | while read GCCODE; do
#Test if the GC code has already been published
if [ ! `egrep "$GCCODE$" "$EXCLUDES"` ]; then
if [ ! "$COUNTER" = "0" ]; then
echo "      	$GCCODE"
TMPFILE="$EXPORT/$GCCODE.tmp"
GCFILE="$EXPORT/$GCCODE"
sed -n "/<name>${GCCODE}<\/name>/,/<\/wpt>/p" "$PQGPX" >> "$TMPFILE"
grep "<groundspeak:log id=" "$TMPFILE" | cut -f2 -d'"' | sort | uniq > "$LOGLIST"
cat $LOGLIST | while read LOGID; do
sed -n "/<groundspeak:log id=\"$LOGID\">/,/<\/groundspeak:log>/p" "$TMPFILE" >> "$LOGID.out"
done
FOUNDIT=`egrep -H "<groundspeak:type>(Attended|Found it|Webcam Photo Taken)" *.out | cut -f1 -d: | sort | uniq`
mv $FOUNDIT " $GCFILE"
rm -f *.out
URLNAME=`grep "<urlname>.*</urlname>" "$TMPFILE" | perl -ne 'm/>([^<>]+?)<\// && print$1."\n"'`
echo "      	$URLNAME"
# Replace some of the XML tags in the temporary split file
echo "      		...Converting XML labels"
sed -i '/<groundspeak:short_description/,/groundspeak:short_description>/d' "$TMPFILE"
sed -i '/<groundspeak:long_description/,/groundspeak:long_description>/d' "$TMPFILE"
sed -i '/<groundspeak:encoded_hints/,/groundspeak:encoded_hints>/d' "$TMPFILE"
sed -i 's/<url>/<a href="/g' "$TMPFILE"
sed -i "s/<\/url>/\">$GCCODE<\/a>/g" "$TMPFILE"
LINK=`grep "http://www.geocaching.com/seek/" "$TMPFILE"`
OWNER=`grep "groundspeak:placed_by" "$TMPFILE" | cut -f2 -d">" | cut -f1 -d"<"`
TYPE=`grep "groundspeak:type" "$TMPFILE" | cut -f2 -d">" | cut -f1 -d"<"`
SIZE=`grep "groundspeak:container" "$TMPFILE" | cut -f2 -d">" | cut -f1 -d"<"`
DIFF=`grep "groundspeak:difficulty" "$TMPFILE" | cut -f2 -d">" | cut -f1 -d"<"`
TERR=`grep "groundspeak:terrain" "$TMPFILE" | cut -f2 -d">" | cut -f1 -d"<"`
COUNTRY=`grep "groundspeak:country" "$TMPFILE" | cut -f2 -d">" | cut -f1 -d"<"`
STATE=`grep "<groundspeak:state>.*<\/groundspeak:state>" "$TMPFILE" | perl -ne 'm/>([^<>]+?)<\// && print$1."\n"'`
# Now remove XML from the GC file
DATE=`grep "groundspeak:date" " $GCFILE" | cut -f2 -d">" | cut -f1 -d"<" | cut -f1 -dT`
TIME=`grep "groundspeak:date" " $GCFILE" | cut -f2 -d">" | cut -f1 -d"<" | cut -f2 -dT | cut -f1 -dZ`
sed -i '/groundspeak:log/d' " $GCFILE"
sed -i '/groundspeak:date/d' " $GCFILE"
sed -i '/groundspeak:type/d' " $GCFILE"
sed -i '/groundspeak:finder/d' " $GCFILE"
sed -i 's/<groundspeak:text encoded="False">//g' " $GCFILE"
sed -i 's/<groundspeak:text encoded="True">//g' " $GCFILE"
sed -i 's/<\/groundspeak:text>//g' " $GCFILE"
# Insert variables into the new GC file
echo "      		...Converting File"
sed -i "1i\Listing Name: $URLNAME" " $GCFILE"
sed -i "2i\GCCODE: $GCCODE" " $GCFILE"
sed -i "3i\Found on $DATE at $TIME" " $GCFILE"
sed -i "4i\Placed by: $OWNER" " $GCFILE"
sed -i "5i\Size: $SIZE (Difficulty: $DIFF / Terrain: $TERR)" " $GCFILE"
sed -i "6i\Location: $STATE, $COUNTRY" " $GCFILE"
sed -i "7i\Geocaching.com:$LINK" " $GCFILE"
sed -i "8i\ " " $GCFILE"
mv " $GCFILE" "$PUBLISH"
touch new
COUNTER=$((COUNTER-1))
fi
fi
done
echo ""
echo "			Reached 30 post limit!"
echo ""
# Pubish the new GC logs to Blogger
if [ -f new ]; then
echo ""
echo -n "Do you want to publish to Blogger (y/n)? "
read ANSWER
if [ $ANSWER = "y" ]; then
echo ""
echo "	Publishing to Blogger..."
echo ""
egrep -H "Found on [12][0-9][0-9][0-9]-" "$PUBLISH"/* | sort -k 3 | cut -f1 -d: | while read CODE; do
CACHE=`grep "Listing Name: " "$CODE" | cut -f2 -d:`
GC=`grep "GCCODE: " "$CODE" | cut -f2 -d:`
sed -i '/Listing Name: /d' "$CODE"
sed -i '/GCCODE: /d' "$CODE"
#google blogger post --blog "$BLOG" --title "$GC: $CACHE" --user "$USER" --tags "$TAGS" "$CODE"
echo "blogger post --blog $BLOG --title $GC: $CACHE --user $USER --tags $TAGS $CODE"
mv "$CODE" "$EXPORT"
echo "		Published: $CODE"
echo "$GC" >> "$EXCLUDES"
done
echo ""
echo "                  New logs published!"
else
echo ""
echo "                  Not published!"
fi
echo ""
else
echo "			No new logs."
fi
echo ""
rm -f *.out
rm -f *.tmp
rm -f "$EXPORT"/*.tmp
rm -f new

Curious Problem with Cork City Locale Geocaching Pocket Query

If you’re a premium member with Groundspeak’s geocaching.com then you will be aware of the ability to create pocket queries. These are really useful for throwing up to 1000 waypoints onto your GPSr for a days, or even a holidays caching.

As some of you know we were in Ireland recently (the reason for lack of posts) and I decided to take advantage of Stena Ferries free satellite wifi on the boat. I set a PQ for Cork and waited for it to build. When the query was ready I saved as usual to my shared Dropbox folder and then attached my Garmin 60CSx but despite loading fine onto my CacheBerry – the PQ just wouldn’y upload to the Garmin.

Puzzled, I tried an older PQ and verified that my script was working, as well as the Garmin was not having some kind of software fault. Next most obvious thing that occurred to me was perhaps the file was corrupted during download, after all it was a wireless connection via satellite on a moving ferry. I tested this theory by downloading the PQ again. Then I downloaded one I’d created earlier. The earlier one (Watford) worked, the Cork didn’t.

Then I decided to test the website PQ builder itself – maybe there was a technical problem. I checked the forums but there was nothing reported, so I posted a thread which didn’t go anywhere. I then tried creating an entirely new PQ of Leicester (never run before). I downloaded and Leicester loaded up onto my GPS no problem.

So there was something local to Cork which was borking my PQ which had to be in the file itself. I didn’t have much time left so I tried a splicing the file with my newly created Leicester PQ. I opened up the GPX file and chopped out the header:

<?xml version="1.0" encoding="utf-8"?>
<gpx xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" version="1.0" creator="Groundspeak Pocket Query" xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd http://www.groundspeak.com/cache/1/0 http://www.groundspeak.com/cache/1/0/cache.xsd" xmlns="http://www.topografix.com/GPX/1/0">
<name>Cork</name>
<desc>Geocache file generated by Groundspeak</desc>
<author>Groundspeak</author>
<email>contact@groundspeak.com</email>
<time>2010-06-16T03:12:46.2642819Z</time>
<keywords>cache, geocache, groundspeak</keywords>
<bounds minlat="51.551967" minlon="-9.37105" maxlat="52.428967" maxlon="-7.593717" />
<?xml version="1.0" encoding="utf-8"?><gpx xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" version="1.0" creator="Groundspeak Pocket Query" xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd http://www.groundspeak.com/cache/1/0 http://www.groundspeak.com/cache/1/0/cache.xsd" xmlns="http://www.topografix.com/GPX/1/0">  <name>Cork</name>  <desc>Geocache file generated by Groundspeak</desc>  <author>Groundspeak</author>  <email>contact@groundspeak.com</email>  <time>2010-06-16T03:12:46.2642819Z</time>  <keywords>cache, geocache, groundspeak</keywords>  <bounds minlat="51.551967" minlon="-9.37105" maxlat="52.428967" maxlon="-7.593717" />

and footer:

</gpx>

I then copied the remaining xml and pasted it below the header in the Leicester PQ, then saved this and zipped it back up.

I ran my script and and uploaded it to my 60CSx – it worked!

I can’t see anything wrong with the header info above but this is where the error seems to lie. Maybe it’s something to do with the coordinates in the boundary tag, or perhaps some hidden character I missed. Does anyone more technical in both xml and WGS84 Datum than me have an idea?

Oddly enough, subsequent PQs for Cork after we arrived worked too.

Solve my Mystery Geocache

I’m headed to Cork, Ireland for a week and a half, so there’ll be little or no posts, check twitter @wafitz for updates.

Currently I’m sitting on a car ferry from Fishguard using wifi@sea – via satellite, pretty cool.

In the meantime, we just published a new mystery/puzzle geocache. To be solved at home then searched for at night following a trail of firetacks.

See if you can solve it here:
GC2A3MP">geocacing.com listing
Mystery journal

Just GPSBabel

A while ago I posted my frustrations with running GSAK on Linux, and how I’d found a way of getting the function to send to my Garmin 60CSx to work.

I thought I owed an update to anyone who read that to say I gave up on GSAK and now just use GPSBabel from the command line. Here’s the script I run:

#!/bin/bash

GPXZIP=$1
NAME=`echo $GPXZIP | cut -f1 -d.`

unzip $GPXZIP
GPXFILE=`ls *.gpx`
for FILE in `echo $GPXFILE`; do
    gpsbabel -i gpx -f $FILE -o garmin -F usb:0
done

I called the script ‘sendtogarmin.sh’. I saved it in the directory where I save all my pocket queries are stored as zip files. When it comes to load them, I just hook up the Garmin and then run:

sudo ./sendtogarmin.sh pquery.zip

Works for me, but I never bothered with using GSAK for much more than sending the pocket queries – I’m not at the stage yet where I feel I have to create complicated queries to get a good caching experience.

A Geocaching FTF Lego Short (stop motion)

I’m currently in the process of editing the film for my geocaching stop motion animation with Playmobil figures. I’m hoping it’s going to take me less than 24 hours in total – and I’m aiming for around 1m30s mark.

In the meantime, check out this awesome stop motion FTF short:

Fixing A Bricked Garmin GPSmap 60CSx (Part 2)

In Part 1 I explained how my Garmin 60CSx booted up with a completely blank screen and doing a firmware update didn’t work – despite the update being successful. Now I’m going to tell you what I did do.

Frustrated I googled a bit more and happened upon this forum post where someone had taken their 60CSx apart and posted photos. The topic here was a broken receiver but the images were useful to me nonetheless.

I decided to pop open my own device and have a look to see if anything came loose. I didn’t take pictures, though I wish I did now, however I can provide detailed steps I took below on taking the 60CSx apart.

Disclaimer – I am not a Garmin technician, and doing this may void your warranty. You may simply want to send it back to them for repair, but I didn’t have a warranty, I bought mine secondhand.

  1. Pop open the battery cover and unscrew the 4 screws on either side, plus the 2 screws at the top of the casing in the deeper holes.
  2. Carefully tug at the back casing to remove – it should come away fairly easily but you’ll need to tear the silicon gel which will affect how waterproof your device is afterwards.
  3. Io unplugged the power supply for the USB/serial connector, I couldn’t remove the other cable for the compression connector but I was able to get inside anyhow with care.
  4. The next part was to prise out the clear plastic chassis. This is quite tight and I actually broke one of the screw hinges. I found the best way was to slide the mini screwdriver down the side and push the side of the casing outwards until it popped out.
  5. After you have the chassis out it’s possible to lift and slide the motherboard and screen downwards, being careful to slide the antenna out of the shock absorber at the top.
Inside the Garmin GSPmap 60CSx
Inside the Garmin GSPmap 60CSx

It then became clear to me what problem was. I noticed as soon as I lifted the LCD screen – the flex connector at the back had come loose!

After reconnecting and putting the motherboard back into the casing, I used superglue to fasten the screw hinge back on the chassis and then No More Nails glue to affix the rubber back in place on the outer casing ( I don’t have any silicon gel to hand). Hopefully it’s going to be waterproof enough again – but I’m glad to say I once again have a fully functioning 60CSx.

I thought this post might be helpful for anyone who finds themselves one day with the same problem.

Fixing A Bricked Garmin GPSmap 60CSx (Part 1)

Last week I had a minor panic attack and bout of depression. After coming back from one of the 10 Year Lost and Found Geocaching events late at night, I dropped my Garmin GPSmap 60CSx on the floor, picked it up and thought nothing of it. The reason being is that the 60CSx is a rugged piece of equipment which can withstand a lot of shock and even full immersion – this one in particular in an unrelated incident has survived being tossed 20-30 feet in a field – hardly a dent on it.

However the next evening I was preparing to load a new pocket query onto the device and powered it up the screen was completely blank! Nothing was loading, I tried banging it, replacing batteries powering up with USB cable but I got nothing. So I did what any guy with insufficient technical gonads to handle this problem, I turned to Google.

My googly friend soon pointed me to this page by Brilliant Corners. Essentially the solution to a similar looking problem was the following method:

  1. Download the latest firmware file.
  2. Double click the .exe and extract the files.
  3. Since the unit won’t be recognized by the firmware updater on its own, use the following key combo: hold down the power button (on the top of the unit) and push the directional button in the up (“^”) position.
  4. While holding those buttons down, double click on the Updater.exe file.
  5. While still holding down the two buttons, make sure your GPS device is selected, and then click the “OK” button to start the firmware update.
  6. During the entire firmware update process you need to hold those buttons down. Then when the update is finished, release and reboot.

Now, this meant I had to boot into Windows Vista and suffer a myriad of updates and other crap until that was finished so I could get to the fix. I had already downloaded the firmware, but I found BC’s link was broken so I went to Garmin direct for 4.00. However, I hardly used Windows for connecting to my Garmin before, so I decided to download the Webupdater to give that a try – turns out the Webupdater worked automatically and using xImage I was able to grab a screenshot of the 60CSx’s ‘desktop’ to confirm it had worked.

But as the discerning amongst you can already tell, if I had to use xImage to take a snapshot of the device – I still couldn’t see past a blank screen. Queue desperate monologuing to my wife as she’s trying to catch up on Lost and reminds me I am speaking over the TV…

So, what did I do next? You’ll have to read Part 2 (coming soon)…

Religious Crap in Geocaches

Groundspeak forums are aflame once again… this time over a month old thread that has recently been resurrected from the grave.

And, then I found it. Slightly larger than my signature business card was this paper religious tract type of a thing.

Shock! Horror! Oh the travesty!

So what do you think of religious tracts left in geocaches? Personally I dislike the idea – anything paper or even card left in a cache ends up becoming damp and soggy – affecting the overall presentation of swag – not to mention does anyone other than the dilligent CITO’er really get much out of trading for them?

I’d like to know what generous Christian traded for their 1 penny tract… is this a case of “Riches I have not, but I do have this handy geocaching-friendly salvation-simplifying cartoon tract…”?

Come on, there’s some much better religious swag that can be used as quality trade items over a soggy tract!

Cross Dressing Lego Storm-Trooper Geocaching Travel Bug

About 6 months ago I had an idea for a travel bug – a lego figure that requires cachers to trade just one item until it no longer looked like it’s former self. This idea morphed into a deserter Clone Storm Trooper who wanted to become an individual… and so this Travel Bug was born:

TB2THBF" TB2THBF

Here’s how he started out:

Cross Dressing Lego Storm Trooper

The mission was simple: Change just one item from this Lego imperial clone trooper, take a photo and move him on.

His first change was body armour, provided by geocacher Boat456.

Change of Armour

6 months later he’s only managed to travel 133 miles but he’s already gone through some major self discovery, courtesy of High Beeches and Wear Pilgrims

Getting in touch with his feminine side...

Where next? Who knows…?

Onto the next glamorous star system!

Thanks to all the cachers who have helped move the Storm Trooper on so far!

A Storm Troopers Odyssey
Tracking in Google Earth