Just a little map I drew based on my towpath amenities routing fun, click to check it out…
There is still snow on the ground, but what’s been falling, overnight and all day so far, is freezing rain. Things have quieted down since last week’s big move, so today we slept in and are doing indoor hobby things: Anne is sewing upstairs, and I spent the morning getting various QGIS add-ons up and running.
This is really a story for another post, but I’d had trouble running SAGA through QGIS (when I was doing those online courses), even though I had SAGA running on my laptop. There had been some upgrades since that misadventure, so I gave it another try the last week, but it was still broken. Then I got sucked in: I sat down and read the error logs, realized that QGIS was calling the SAGA routines with outdated command line parameters, and managed to batch fix the QGIS end of it — 250 commands fixed with a simple, multifile search-and-replace, two minutes and I was done. And it worked!
I got so excited that I SAGA’ed the shit out of a bunch of data, realized I had no current use for the tool, and decided to install and play with a bunch of other processing add-ons, like hydrological (flow and runoff) modeling with TauDEM, satellite image processing using Orfeo, and statistics using R, which I already had installed. TauDEM and Orfeo seemed to work fine, but R didn’t so I spent some time getting that figured out. I think I like the idea of these tools more than actually using them, because I get a lot of satisfaction out of getting them to work.
Anyway, there will be no outdoor sports activities today, or even outdoors at all given the general nastiness in the air (and slipperiness on the ground). We’ll probably go out to the usual later with John and Donna — we went out to Easton last night with them, but found Two Rivers and Porters both completely full up, and Black & Blue still closed, so in effect we did the “Beermuda Triangle” without any beer, drove back to Bethlehem, and went instead to the Beef Baron, which was a nice change of pace.
Here we are, February already, and only now dealing with the first big snowfall of the season… unfortunately, we only got about 5″ on the ground here, though other areas got quite a bit more — Anne’s sister is visiting from Connecticut, and called home to find that they got more than a foot “so far,” along with high winds and thunder. The ground is white here, and we had to shovel the cars out, but that’s really all she wrote. The snow is too shallow, and too wet, to be much good for winter fun. (It was a work day anyway: today was the day we moved Anne’s mom into her new place. Tomorrow will be more of the same, as we move her furniture and set up her apartment.)
Yesterday was warm and sunny, literally in the sixties, it’s hard to believe the difference from then to now. I put my singlespeed back together yesterday — all it really needed was to have the tires and pedals put back on — then rode around the neighborhood all afternoon.
Wooo! Did the Superbowl of Chili yesterday with Eric and his neighbor George, and we had a beer-and-chili-fueled blast, if you’ll pardon the pun. No morning run, but that’s fine, Anne and I may do a hike in Jim Thorpe this afternoon.
Meanwhile… My WordPress page (you’re looking at it) uses a theme called Raindrops, which I like a lot of course, but it seems to be a hobby project of some guy in Japan, and there is a persistent error in his code. Specifically, he’s missing a closing anchor tag in the function that creates “featured images,” so that on a page with a featured image, everything after the image is part of the link back to the image’s page. It’s easy enough to find and fix (I did it) but my attempts to contact the author about the error got me nowhere.
Like I said, fixing this error is easy enough, but the Raindrops theme gets updated a lot, and when it does, the file with the corrected code gets overwritten (with a newer version of the buggy code). Every update would find me going in and manually re-doing the fix — it got old.
WordPress themes are built so that one can refer to another, as in a parent theme and a child theme, and the child would inherit from the parent theme all its attributes (layout, behavior etc) except those specifically overridden by the child theme, which can also add functionality etc. This seemed to be ideal for my needs: I could create a child theme, which would only override that one bad function with my corrected version.
My first look at this, several months ago, made me think it wouldn’t work: the original theme’s function coding has to be set up to allow itself to be overridden (each function is tested to see if it does not already exist before being defined), and I could have sworn that my parent theme was not set up like this. I looked again more recently though, and sure enough, everything was good. (Maybe I was mistaken in my first look at the code, or maybe this was added in one of the theme’s many upgrades.)
So I’m good to go, and late last week I sat down and made my child theme, and that all worked out fine. The real moment of truth came this weekend: the parent theme had an upgrade, and the upgrade didn’t break my website. Success!
Remember how I said my only New Year’s resolution was to ride more this year? Well, procrastination FTW: I just got out for the first ride of the year today… Out along the towpath, taking pictures of old locks and industrial ruins. Cold but sunny, it was a pretty nice day for a ride, even though the ground was mushy in places and there were headwinds on the way home, and it felt really good to be riding.
By the way, tomorrow is the big Chili Contest in Easton. I’ll be meeting Eric and his neighbor George there, and maybe Doug and Lori, and I expect to see a whole bunch of the old Easton crowd as well. I just may get up early and do a short run before going over, but as they say, we shall see.
This is my second post in a series, where I report back on my results from playing with various ways to use routing, in QGIS and related programs. My immediate task is to identify those cycling amenities that are nearest to access points along the Lehigh Towpath. You can read Part 1 (the introduction) here. In this post, I’ll be using the QGIS built-in Network Analysis Library. Follow along after the break…
Imbolc. Groundhog Day, Saint Brigid’s Day, the day the Swedes get pretty maidens to wear candle-festooned tiaras to celebrate the turning of the sun toward Spring… It was cloudy this morning, but apparently bright enough that Punxnatawney Phil saw his shadow, and predicted six more (more? more!?) weeks of winter. Sunny out now, I might start to get the bikes ready, groundhog or no.
We went out last night to the usual, to celebrate a break in our recent activity overload: Anne’s downstairs offices are painted and rented, and a recent family health situation has resolved itself, at least partially and for the moment — it was definitely break time, and a much needed and well deserved break at that. We met John and Donna there, and also saw Doug and Lori, and though it wasn’t the latest of school nights, we managed to have a pretty good time, with much good conversation.
Today I have an evening class (solid modeling with SolidWorks) over at the Fab Lab, but other than that — and for the first time in weeks — not much else to do today. I’ll probably play a bit of catch-up on household chores, maybe do some bike work, and then later we’ll go over to the Allentown Farmer’s Market, with a lunch stop at Sib’s Deli. Ah, Reuben, how I’ve missed you!
Anne rented out (almost) the entire first floor of her office building to an architectural firm. They will be moving in on the first, so we’ve been in overdrive, downsizing her office and moving it upstairs, then cleaning out and painting all the downstairs rooms. We were at it for the better part of last week, and we have this week to finish — it’ll come down to the wire but I think we’ll make it.
Meantime, tomorrow we get our new washing machine. The old one died just before Christmas, and we’ve been waiting “for things to settle down” after the holidays, before shopping for a new one. Well, things never did settle down, so I did a bunch of online research, and then went to Sears on Saturday, to buy one in person.
Life goes on…
Next up on my reading list: Spook Country by William Gibson. This completes — years later, and read out of order — his post-911 trilogy (along with Pattern Recognition, the first, which I read first, and Zero History, the last). This suffered from Gibson’s usual outdated spy-cool and brand-name-dropping, and his penchant for odd technological whiffs, but I think it was the best of the three: besides and despite his flaws, it displayed his talent to build a gripping story (especially in the second half of the book), with realistic and engaging characters. I still think that the Sprawl trilogy was his best, but this was a good bedside companion for a week or so.
This is the introductory post for a hopefully four-part series about using QGIS to find the shortest path between two points, not shortest as the crow flies, but following a given network of roads. This is called routing, it’s what’s Google Maps and other mapping software uses, and it relies on graph theory and network analysis to do its job. I’ll talk about the what and the why of this little experiment here; the how (for three different versions of how) will be the subject of subsequent posts.
UPDATE: Part 2 can be found here.
The reason I’m looking at all this goes back to my interest in cycling tourism, and my attempts to identify cycling-accessible amenities — convenience stores, restaurants, hotels, that sort of thing — along the Lehigh Towpath. My first attempt (you can find it here) basically looked at a region, within a mile (as the crow flies) of one section of the Lehigh River, and searching within that region for the amenities I was interested in. That was an interesting project in its own right, but, as I said in my earlier post, it didn’t really solve the right problem: there are many places within a mile, or even a quarter mile of the river, that are not anywhere near accessible from the towpath: they may be on the wrong side of the river, say, or not near a towpath access point. To be considered accessible, the points of interest would need to be within a mile (or whatever arbitrary distance I end up choosing), by road, of an access point on the towpath.
I didn’t really have a plan to make this happen yet, but with or without a specific plan, I figured my first order of business was to get the information I would use. That previous analysis used Google Maps, but I felt that their data was a bit encumbered (in terms of my rights to it), and it seemed that Google didn’t play as well as I’d like with QGIS anyway, so I decided to use the data available through Open Streetmap, for both the road network and the set of amenities. (I already had a collection of the towpath access point locations left over from a previous experiment.) I got those sets of data, and massaged them so that I only had the parts that fell within a mile of the bike paths in the Lehigh Valley. This gave me the data seen to the right, where the aqua lines are the road network, the red lines are bike trails (the towpath, plus the Palmer Bike Path), the red stars are trail access points, and the orange dots are the amenities (restaurants, fast food etc).
(One note about the road network: You probably can’t see it at this resolution, but I made a point of excluding roads that are not practical/legal/safe for cycling, like US-22, I-78 and a few others. There are also a number of places, like the New Street and Hill-to-Hill Bridges, where roads or the trail are connected via stairways to the bridges above; after our own struggles, a few years ago, with stairs and fully loaded touring bikes at the Ben Franklin Bridge, I decided to also exclude stairways from my network.)
So that gets us the data, what about the analysis? My first thoughts were to see if I could find all the points on the road network that were a mile away from an access point, then connect the dots to define a region, and then find all the amenities within that region. My second thoughts were that this approach would put me back in the same situation as my first attempt, since I could easily find roads that were not reachable within that region, such as bridges. (Bridges became my nemesis for a while.) I eventually decided that my best strategy would be to find the shortest route between each access point and each amenity, and select from the amenities based on the lengths of the routes I found.
To perform the actual routing analysis, I have three options:
- the GRASS networking tools available through the QGIS GRASS plugin
- PostGIS with the pgRouting extension
- the Network Analysis library available through the QGIS Python interface
In terms of a learning curve, I have some experience with networks in GRASS, and I feel at least a little comfortable with Python (and copy-paste, with scripts I find online), so pgRouting will probably be the most difficult for me to pick up. Meanwhile, the Network Analysis library can use the data I already have, but Open Streetmap deals with road networks in a way that’s not directly compatible with either GRASS or pgRouting — their topological models are different, but that’s an issue for a future post. I would have to either re-import the road network to get it to work with pgRouting, or further process the one I have for GRASS.
Each one of these approaches will be the subject of its own post. Given that the Python approach is not the hardest, and my data is already in the form I’d need, I am going to try my hand with the Network Analysis library first. Stay tuned for Part 2, whenever…