Archive | geocaching
Why go geocaching?
A great thread at the Geocaching.com forums:
I’ve been geocaching for over a year now, and wanted to share my impressions with those just starting, or thinking about giving it a try. I have been involved with many hobbies and sports for 40 years, and have always enjoyed pondering the advantages and disadvantages of each of them. Well, I’m beginning to think that geocaching is just about as close as you can get to a perfect hobby/sport. Let’s look at some of its many advantages. I’m hoping other cachers will pitch in and add to my list:
Why to I enjoy geocaching so much? Most of them are repeated in the thread:
- It’s cheap. After the initial GPS, you really don’t have to buy anything for it ever again. You can buy more, but you don’t have to. And your hobby doesn’t suffer for it.
- You can do it anytime, anywhere. It’s probably the most portable hobby around
- It’s family-friendly. Take your nieces, nephews, in-laws — whoever you want
- You discover new places. There are a lot of neat parks in Omaha that I would have never discovered without geocaching.
Geocaching update
Yes, I did some geocaching on our trip and I thought I would make a separate post on that.
I got #50 on the way home. It was a much longer walk and more bushwaking than I wanted to do (especially at a rest stop!) but, hey, it was for #50. My favorite find of the trip was probably The Drake Bridge mostly because of it’s location. And the Chef’s New Clothes is just about the easiest cache I have ever found — virtual or not.
I also finally grabbed some lithum AA batteries for my GPS. For some reason, I’ve never been able to find any in Omaha. Though they are quite a bit more expensive, they are supposed to last a lot longer. The package said 7x longer — I’ll believe it when I see it, but I would be happy with 3x-5x longer. Well, I had my GPSr on most of the drive home from Austin and it battery indicator still says 100%! If this was the normal alkaline battery they would have went out or been mostly out of juice by now. Wonderful stuff!
Key West (GCJ3JM)

Okay, Josh did all the heavy work, I was just there for the end.
A Real Ruby XML script
Here is a problem that I have been having and I have just solved it via Ruby and REXML:
I have two GPX files that I use for geocaching — one contains all the caches that I want to find and another contains the ones I have already found. Keep track of your finds are important — you can make sure that none of your finds sneaks back into your “soon to find.” What I wanted was a script in which I would give it a list of waypoint names and it would find them in the “everything” pile and move them to the “found” pile. Sounds easy, right? Well, these piles are XML. So now it is no longer trivial.
Yeah, I’ve written DOM scripts before in which I moved nodes from one XML file to another. It ain’t pretty. Since I’ve been liking REXML so much, I decided that I would try tackling it with that and Ruby. My result is called markfound.rb and you can find it here.
The only bad thing about it is the speed. The “everything” pile is 1.3MB (down from 18MB — see a previous post) and takes a while to load. And “found” pile is smaller, so it doesn’t seem to take as long. Of course, both files will get bigger as time goes on. Hopefully, REXML will get faster as that happens. But since the time is spent in loading, I could give it 100 waypoints to move and it wouldn’t be that much slower. Hey, at least I know where the bottleneck is.
There was a surprising thing — a suprise in a good way. What I did was find the tree containing wpt tag that has the proper waypoint name, add it to the found pile and remove it from the everything pile. In DOM, this is about three or four calls. In Ruby/REXML, it was one:
foundRoot.add(cacheInfo[cache])
REXML knew that if I was adding an element from DocX into DocY that I wanted to remove it from DocX. This feature is genius. Okay, it maybe a bug. But it worked out well for me.
Cleaning out your GPX files
I noticed that my “all caches I may hope to find” file has grown tremendously since I starting putting Groundspeak’s info in (i.e. their tags in their namespace). I knew what was doing it — they put in all the logs in, which I don’t really care about. This morning, I was grabbing some caches to put in my GPS and noted that it was taken a while. So I looked at the size of the file. 18MB! Yeah, it was time to go something.
I decided that the best solution was an XSLT. “What? XSLT?!?” Yes. It’s not my favorite thing to do in the world, but writting a Python/Ruby script to do DOM work for this seemed too hard. I was going to delete nodes — a lot of nodes — on a file that was going to grow bigger over time. This was a job for XSLT.
And, just like I thought, it was fairly simple. Maybe one of the easiest XSLT’s you will ever see. Check it out here.
Oh, and my 18MB GPX file? It’s now 1.3MB.
