• Category Archives the sporting life
  • Biking, running, weights, yoga…

  • New Project: Down the Rabbit Hole and Still Digging

    I started looking into my new project the other day. The first steps will have to be extracting information from GPX or FIT files, and adding the information to a PostGIS database. I managed to do this in several ways, mostly through a combination of GPSBabel and ogr2ogr, though no single way has done exactly what I want yet: ogr2ogr automatically adds GPX data to the tables in a manner similar to what I want, but extension data (heart rate, temperature) is not treated the way I want, while the FIT data needs to be extracted first into a format readable by ogr2ogr, and then put in the right table form after being put in the database, all of which turned out to be surprisingly easy. (Even so, I may just choose to go with adding the data from GPX for now.)

    The biggest problem I’ve run into so far is that GPSBabel does not extract all the data from the FIT file, and FIT is a proprietary, binary file format — I can’t get lap information, for example, just by scanning the file with awk or something. I may have to download and use the (again, proprietary) FIT SDK, in a C or other program I write myself. This may fit in well with what else I have to do, since I can call the parts of ogr2ogr I specifically need, directly from C.

    Before it gets to that point though, I have to decide what I especially want to do with this data, which will tell me what I need to extract, what I need to save, and what I can disregard, or discard after processing. Do I want to build a full-blown replacement for Garmin Connect, where I keep all relevant data? Or do I want to just build something, like a web badge, to show a minimum of data about the ride, data like distance, duration and a map of the ride, with maybe a link to the ride’s Garmin activity page? I am leaning towards the minimalist approach (which would entail just saving one record per activity, with fields containing aggregate data), but I think I want at least some of the individual track point data because I may want to graph things like elevation or heart rate.

    But maybe I don’t need to keep trackpoint data to build my graphs on the fly. Maybe I can make small graphs as PNG’s or GIF’s for the badge, and store those images in the database — hopefully they would be smaller than the trackpoints themselves. Alternately, I could store the entire FIT file (which is actually pretty small) in the database, and extract whatever I need on the fly. (I would still do a one-time analysis to get and store my aggregate data, since this might be a little too slow for on-the-fly data generation.) These choices will depend on the results of all the little coding/database/GIS experiments I’m doing now, extracting, converting and aggregating sample data.

    Ten Years Gone: This is what I wrote on this date in 2008. We voted today, and I remain hopeful, but it is certainly not as happy a day as that one was, and even with good news I don’t think we’ll match that day.

     


  • Towpath Life

    I have a bell on each of my offroad bikes, but I normally don’t use them — I prefer verbal communication when I overtake someone, since it’s more effective and (in my opinion) way more polite. Yesterday, on the way back from the Museum, I came across a little old lady walking her German shepherd, and called out my usual “hi, passing on your left!” She moved over to the left (oops!), but by that time I’d stopped, and we were doing that neighborly, chuckling “yes, hello, passing you on the towpath” sort of greetings and negotiation, when her dog just absolutely went bonkers — barking, snarling, leaping at me at the end of its leash. It looked for all the world like an attack dog in some kind of video.

    It dragged the woman over as it came at me, completely out of her control — luckily it was not as hardcore as it wanted me to believe, because when it attacked it went for my ankle. Luckily again, I was wearing street clothes, including hiking boots, and the dog couldn’t really get a purchase on them. (I’m guessing it happened too fast for me to react, since I felt strangely calm throughout the entire situation.) All the while the woman was yanking at the dog, and when she finally got it under control I got a little snarky and said “good thing your dog was on a leash.”

    I don’t think she got it, because her reply was “well, it is the law.” I just rode off…

    Her parting shot, once I was down the trail? “If you had a bell you could have warned me!” I was tempted, but I didn’t ring my bell.


  • Race Day

    Well, we’re back from the half marathon in Hersey, and now back also from our nap…

    The race started at 7:30 AM, so we had to be there at say 6:30, so had to leave the house at 5:00, meaning we all had to get up by 4:30. We were all in bed by 9:00 last night, but it was still a hard morning. We got there about 6:45 — crazy parking traffic — and that was almost like “just in the nick of time” considering the bathroom lines, but Bruce & Heather lined up with no problems and the race went off without a hitch, then just as the race started we met up with Lorraine.

    We walked around to several different vantages together, managed to see all our runners (Heather & Bruce, and Adelle & Liz who did it as a relay), and I even got a few photos. The whole thing was over by about 10:00. After navigating back through the parking traffic mess, we all met up for brunch at a place in Hersey. Good to get some food and to catch up with everyone, but it had been a cold, windy day and the place was chilly inside; we were glad to get back in the car and crank the heat. We were home by 2:00.

    New Tools Bring New Opportunities

    One area on my routing map has been a bit problematic: Rt 329 out of Northampton goes past a reservoir, or old quarry or something, and the DEM elevation data dips pretty hard right next to the road, as well as under it at a bridge. Since I find total ascent and descent for each road using interpolated DEM data at points along them, the roads that go over, or even just near, big elevation changes can have large ascent/descent values even of they are relatively flat.

    The bridges have had an easy enough fix for a while: I simply make the ascent and descent (and adjusted ascent/descent) zero for each bridge, and I do the same for very short roads connecting to the bridge, like abutments. In other words, I fudge the data… (I figure the bridges are all fairly flat anyway except some longer, river-crossing ones, and since those are pretty far apart their actual ascent/descent values won’t affect the routing calculations much.)

    Fixing these roads near the quarry was a bit harder. I didn’t want to set ascent/descent values down to zero for the whole long and moderately hilly road, but now that I can update the ascent/descent data much more quickly — this was that “the task went from several hours to under a minute” process improvement from the other day — I was able to do my fudging on the elevation-at-road-points data: I made the elevations in the “dipped” spots the same as the points just outside, then re-updated my database with the new script. It worked great, the roads now route more realistically in that area, and it took about 5 minutes to do.


  • Brew Day

    The Hershey Half Marathon is tomorrow. Neither of us is doing it, but a number of Anne’s nieces and nephews are, and Heather & Bruce are coming to visit today so they can be closer to Hershey for tomorrow morning’s drive. It’s still pretty far, they could have found somewhere closer I’m sure, but we’re also brewing today (we’re doing our Bell’s Two-Hearted Ale clone) and they want to learn the process. They should be here in about an hour, and the brew stuff is all set up in the backyard. Of course Anne is cooking up a storm.


  • Trail Summit

    So Sunday (last Sunday, not yesterday) was a recreational day for the Eastern PA Trail Summit, and I had an invite — a free pass really, courtesy of the D&L — to the whole event, so I rode to Easton to check out the Canal Boat ride and the industrial history tour. Both were awesome despite my stubbed toe…

    (Both events were informative, but while anyone can get a picture of canal boat life from what’s currently on display, and it’s common knowledge that there were once many factories along the canal, it was truly eye-opening to have someone point and say, “right there was a giant textile mill, and in that empty field there was once a blast furnace, in fact that boulder is what’s left of its foundation.”)

    Very cool, and here are some photos from Sunday:

    Scott S was also at the park that day, doing a kid’s bike ride with the Easton Police. That was pretty cool, and nice to see some cycling friends there with their kids.

    The Trail Summit proper was Monday and Tuesday. I had no real idea of what to expect — I actually had to look up what a “breakout session” was, and what the difference was between “keynote” and “plenary” speakers — but they were two awesome, informative and inspiring days.

    I learned a new term – “inland port,” sigh — from Northampton County Executive Lamont McClure, who spoke of it as one of several competing visions for the Lehigh Valley (as opposed to “nice place with trails,” I suppose), and the keynote speaker, a woman who thru-hiked the AT and spoke of it as a life-changing experience, made me realize that the Lehigh Towpath changed my life as well. There were morning sessions on redesigning roads to accommodate trail sections, and afternoon sessions on marketing your town to trail users, and a cyclist, the speaker for Tuesday’s lunch, said we need more amenities and signage. Amen brother!

    There was a dinner Monday night at the National Museum of Industrial History, so of course we all toured the museum. Here are a few photos:

    Not everyone was an awesome speaker, even if their ideas were good, and not every session was informative — there were a few I actually disagreed with — but all in all, it was an awesome conference.


  • Bike Week!

    Bike Week — that was what last week became. The first four days I helped Scott S with the Road Scholar cycling program (that he helps run out of the Shawnee Inn), Friday was a ride with Anne, Shari and Julie to that great coffee shop in Northampton, and Saturday I did a mapping expedition down the Delaware Canal to Riegelsville. (Sunday was a trip to Philly, for brunch with Ben and Candace.)

    The four Road Scholar rides were: Bethlehem to Easton via towpath, Allamuchy (in the rain!), Cherry Valley Road near Delaware Water Gap, and White Haven to Jim Thorpe via the D&L trail. Here is a video one of the guides made of our rides:


  • I Care About Nutrition, Part Infinity

    I was supposed to go for a lunch-hour ride today with Greg H, but his office was shorthanded and he had to bail. I went out anyway, just for an easy towpath ride, but by about five miles I was sluggish and exhausted and couldn’t go on. I stopped at Farmersville Road, ate some shot blocks and two GU packs, sat for a while for them to take effect, and then moseyed my way home. I think I guessed right: whatever ailed me was nutritional, and I felt much better on the way back.

    I also think I lucked out, because with Greg I’m sure  we would have done either Lehigh or Sals, and I would have been dying. I still have no idea what could have made me so drained — I haven’t overdone the physical activity lately, and we’ve been eating much better, since our return, than we have in about a month.

     


  • To The Bat Cave!

    Posted on by Don

    I did an exploratory ride today with my friend Renee E, at Wildcat Ridge Wildlife Management Area (basically Splitrock, near Rockaway NJ). Neither of us had ever been there before, but Renee had heard good things from some friends, so off we went…

     

    It was a great place: a whole lot of technical riding (some of it above my pay grade, leaving me walking the tougher sections), along with some really sweet singletrack. One highlight was going up a trail to what was called “the bat cave,” an old mine with some seriously cold air coming out of it. This was early in the ride and we were still both pretty spry, so we took a few selfies before moving on.

    Renee had a bit of an itinerary, some trails she’d heard we should ride, and even though we didn’t really have a grip on where we were much of the time we managed to hit most of them. Later, after my GPS died, and her phone (with trail maps) died, and we started getting lost and eaten by bugs, we’d had enough — we found our way through a nearby suburban development to the road back to our parking lot. We were out about six hours, maybe four of them riding. What an awesome day!


  • Odds & Ends

    Posted on by Don

    I have a bunch more photos to put up about the final leg of our vacation (Ben’s graduation), but before I get to that I have a few other items, and a few other vacation photos, I want to post that really don’t go anywhere else.

    Vacation Miscellany

    Just a few photos of things around the cabin. Our place apparently was a camp once, having multiple primitive cabins, etc, and had been refurbished — and had the main house added — after years of downward fashionableness and possible abandonment; three cabins were still standing, one converted into a sort of detached den or game room, and the other two converted into separate sleeping quarters. Behind the cabins, as things were now arranged, was a small pond with a dam at one end. I’m not sure how important the pond had been in the past — it had the look of a kiddie fishing area — but now it was brown and scummy, and working its way back to being a meadow. (The lake was a lot better, but the muck at the bottom made for unpleasant swimming. Only Alex and I tried, and we only tried once.)  There were other camp amenities, including a fire pit which we made use of on the chilly nights.

    Shapes and Clusters

    The clustering experiments were a success, but what I really want is to show the regions or neighborhoods where my cycling amenities are clustered. I’ve been trying several different ways to build a shape around a group of points:

    • Convex Hull: this one is pretty nice, it’s the shape you’d get if a rubber band were stretched around the points. It’s also built into both QGIS and PostGIS. Unfortunately, if the point cluster has concavities the convex hull won’t show them — an L-shaped cluster would get a triangular region.
    • Concave Hull: this one is also available in both QGIS and PostGIS, but I don’t trust it — I can’t find too much about how it really works, its very name doesn’t make all that much sense, and it requires parameters that are not as well documented as I’d like.
    • Alpha Shape: the most promising of the bunch, defined pretty rigorously in “the literature,” and I like the l looks of the shapes it makes. Unfortunately, it doesn’t exist in either QGIS or PostGIS; it is available as a package in R, so I’ve spent some time this week getting R to run correctly after much neglect, then installing the “alphahull” package and trying it out. I managed to import my data and  create alpha shapes; now I have to find how to convert and export the shapes back into my database.

    There is one other method I just thought of, and pretty simple compared to these approaches: I could just make a heat map from the clustered amenities, then use a “contour line” function on the heat map raster. If the others don’t give satisfaction I may try this.

    Around Here

    Today was a brief respite from days of heavy, almost continuous rain — more is coming, starting tomorrow. I took the opportunity to attack the jungle that once was our back yard, managed to use up all the weed-whacker twine, and ran over a yellow jacket’s nest (no stings, but a fairly hasty retreat into the house for a while), and the yard looks much better if not quite 100% yet.

    We’ve also had a Warm Showers guest: a young Brit named Arron who landed in New York and is cycling across the US. He’s early in his ride, not quite acclimated to cycling, and he’s getting a real baptism by fire, or at least by rain and hills and poor road choice, but he was a trooper. He stayed for two nights before heading for Coopersburg.


  • Kayak Day

    Posted on by Don

    Anne and I took the canoe out for a short paddle the first day we arrived, but later in the week we went out on the lake “for real,” in kayaks with Laura also in a kayak, and Joe & Alex in the canoe. We had a good time exploring the pond and the lake, but I really don’t have much to say about it so here are a bunch of pictures.