Archive | geocaching

More Fun with gpsbabel

Feb 7th, 2006No Comments

Sorry I haven’t posted much in the past week or so. All last week I’ve been in a training class (perhaps more on that later) and this week I’m trying to catch up. And today I was told that the first build of the new release is due next week. Arrgh!

So, anyway, I took some time and mucked more with GPSBabel. The problem: I wanted to get just the Omaha-area caches out of my GPX file that contains everything. I used the county polygon files from the wonderful gpsbabel-data package and came up with this:

gpsbabel -i gpx -f everything.gpx \
-x stack,push,copy \
-x polygon,file="Nebraska/31-055-Douglas-(County).txt" \
-x stack,swap \
-x polygon,file="Nebraska/31-153-Sarpy-(County).txt" \
-x stack,pop,append -o csv -F -

This worked wonderfully for me. But the problem is that the Omaha area covers much more than two counties — it’s more like six. I came up with a solution that I really didn’t like that involved a lot of swapping my uber-list around in memory. I submitted it to the gpsbabel-misc and someone suggested a different version: take the everything list, take out all one caches not in the counties (i.e. “exclude”) and then toss out all duplicates. Brilliant! His version read the uber-list twice. I made one that popped a copy to the stack and popped back at the end:

gpsbabel -i gpx -f everything.gpx \
-x stack,push,copy \
-x polygon,file="Nebraska/31-055-Douglas-(County).txt",exclude \
-x polygon,file="Nebraska/31-177-Washington-(County).txt",exclude \
-x polygon,file="Nebraska/31-153-Sarpy-(County).txt",exclude \
-x polygon,file="Nebraska/31-155-Saunders-(County).txt",exclude \
-x stack,pop,append \
-x duplicate,shortname,all \
-o csv -F -

(No, I don’t have the Iowa counties in next. I soon will.)

Intro to Paperless Caching

Jan 26th, 2006No Comments

A few years ago, I had a Palm IIxe and I loved it — I loved having my datebook and addresses with me, and, yes, even having games with me wherever I went. But it died suddenly. I was able to bring it back to life for a little while this fall, but it quickly died again. A little research showed that there was a problem with the entire Palm III series with battery drain. Oh well . . .

But I still wanted a Palm and, when I listened to this PodCacher podcast, in which Dan-O talks about paperless caching and the fact he bought a nice Palm on eBay for cheap, I knew I needed to do it. A little looking showed me that I wasn’t going to get it as cheap as Dan-O did, but still reasonably enough. Of course, I wasn’t going to get a Palm III again. I decided on an m130 for the following reasons:

  • Color screen.
  • SD expansion card
  • USB connect (down with serial!)
  • Rechargeable Battery

The expansion card was the most important, because I wanted to be able to put in plenty of caches and not have to worry about memory issues. The rechargeable battery was a close second, but most third-generation Palms have them anyway.

So, after bidding half-heartily on a couple, I got agressive on one and got it for a very reasonable price. I had checked out the prices of SD Cards and one was going to cost me almost as much as the Palm! When it arrived, though, the owner thoughtfully (or thoughtlessly) left a 128 MB card in the slot. Yes!

But before that, during shipping, I played around with Plucker and Geocaching.com’s website. Yes, it is possible to use Plucker to grab the printer-friendly pages from Geocaching.com. Yes, it’s quite easy. And, no, I’m not going to tell you how — Geocaching.com is known to be draconian about their content. You can figure it out on your own. It’s not hard.

So, I have caches on my new (for me) m130 but haven’t used it for caching yet. “Yet” being the appropriate word.

My First Real Ruby Script

Jan 25th, 2006No Comments

Here I present my first working Ruby script that actually does something useful. I wrote it yesterday but wanted to do some more testing before presenting it here.

The Problem: I wanted to take the geocaches from the geo-nearest script (see the geo-* scripts which I have talked about before) and put them into my GPX cache respository. geo-nearest can save it’s results as a GPX file, but it saves the sym tag for each waypoint as Geocache-type (like Geocache-found, Geocache-multi, etc.) instead of just Geocache. When I import this into my GPS, it doesn’t know what icon to use so it uses the ultra-useful Toll Booth icon. So I needed something inbetween to change all the sym values before saving into my repository.

In theory, I could have just used a sed call on the GPX file and probably have been alright. But I knew that someday that would change something that it shouldn’t. Therefore I decided to use an XML parser. And, like any good student, I’m using the language I’m trying to learn at the moment. So here is the script in question:

#!/usr/bin/ruby

require "rexml/document"
require "tempfile"

# Send an argument (like coordinates) to the geo-nearest script
gpx = REXML::Document.new `geo-nearest -f -o gpx -O -  #{ARGV[0]}`

gpx.elements.each("//wpt/sym") { |tag|
  tag.text = tag.text.gsub(/-.+$/,"" )
}

tf = Tempfile.new("gpx")
tf.puts gpx
tf.flush

## 'addcache' is my script that some magic before running the GPX with
## gpsbabel.  you could just call gpsbabel directly
system("addcache #{tf.path}")

Okay, there isn’t anything Earth-shattering here. But the part that surprised me is that changing the text using REXML was so easy. Using Python’s minidom, or any DOM interface, I would have had to find the text node and then I may not have been table to change it. I would have probably had to make a new text node, delete the old one, and then import the new one. That would have been a lot more work and slower. Instead it was all in one line.

This script would have been much more difficult for me to write without the great examples at the PLEAC-Ruby site. If you’ve never checked out the PLEAC Project, I would highly recommend you do so. And, no, it’s not just for Ruby.

Today’s PodCacher show

Jan 23rd, 2006No Comments

In case you are curious, I’m the Mike mentioned on PodCacher » Show 36: The Degree Confluence Project. The video I refer to in my comment is from the Christmas scagvenger hunt he made Sandy go on to get her Christmas present. For some reason, I can’t find it on the site anymore.

Geocaching on MLK Weekend

Jan 18th, 2006No Comments

Sorry for the delay in this post — I’ve been busy and a bit under the weather. More will be explained here . . .

All of Gina’s family was in town this past weekend and all of them had heard about this geocaching thing. I offered to take any or all of them on some caching trips. I had already picked some around Lake Zorinsky, since it’s close to our house and there are quite a few caches around there. Saturday was a beautiful day, and Gina’s two brothers and our brother-in-law volunteered to go out on a hunt. We found the two Sammy Chicken Legs caches on the southeast side of the park — both of them were easy to get to. We called ourselves “TheHaas and the Poss” on the logs and the website. Sunday was even nicer, and, again, the same brother-in-law and our sisters-in-law wanted to go. We called ourselves “TheHaas and the Outlaws”, since it was just the in-laws that wanted to go. This time, we went to the northwest side of the park, which I have never been before. The three caches were found were not so easy to get to — we had to do a lot of bushwacking to get there. But we were walking outside in our shortsleeves in January — what a feeling!

Alas, I didn’t think about my allergies while bushwaking on Sunday. On Monday, I had sore throat and just thought it was one of the colds going around. On Tuesday morning I woke up with a horrible sinus headache, called into work, and spent the rest of the morning in bed. So, even though it’s January, when walking in the weeds, I still need my allergy meds!

And then, just to get my geek on, I used the geo-map script to generate a map of the caches we found around Zorinsky. Yep, it’s a bit large. I used Tiger to generate the map, and it looks better than I thought it would. Of course, Tiger data and images are public domain so that’s about all I could use if I wanted to put it up on the web.

Page 3 of 5«12345»