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.
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.
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:
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…
I still have no idea what’s going wrong with scanning photographs of QR codes (other than, say, generic image quality issues inherent in the process), but I’ve sort of abandoned the whole QR thing. The obsession ran its course, and there was also this:
We went out last weekend with John and Donna, and also a friend of ours who is a programmer. She asked me about my recent projects and I said I was intrigued with QR codes, and she said something to the effect of “Oh, aren’t they a bit passé?”
What?!?? I asked John, and he also felt that they were a technology that seemed promising maybe a few years ago, but eventually the buzz faded as they were seen to be superfluous — users could write information (or capture the info another way, like near field communication) as easily as they could use a phone to scan and capture it from a QR code.
I went home and did a little Googling and — except in the marketroid world where it definitely seemed passé — the situation wasn’t nearly as dire as the picture my friends painted, but what I saw online did make me reevaluate their usefulness, to take stock as it were, and my interest, already waning, disappeared.
I’m not sure why I did this exactly, but the other day I decided to download a QR code generator onto my phone. I have no real need, but it looked like a fun thing to play with, so I made a few codes (my contact info, “Hello World!” etc), then I thought it would be pretty cool to read and write them from the laptop, so I downloaded a program called qrencode to write them, and one called zbar to read them, and I had a bunch of geeky fun using all my new toys.
Then I got the idea: what if I could take a picture of a QR code, with datestamp and GPS metadata added? I could then extract the QR data, and the time and place it was gathered, like maybe something an inventory program would use. I downloaded another program called exiftools, and found how to get the date/time and location from the photos, but the final step, extracting the QR data from the photo of the QR code image, was a failure. I have no idea why yet.
We saw it the other day, basically as soon as it was out in a nearby theater. We happened to go on a weekday matinée, which is what we usually do, but unlike other matinées the place was packed — it looks like we weren’t the only ones who wanted to see this movie. And it did not disappoint: this was one of the few times where the movie audience applauded at the end. My advice: go see it. (You’re welcome.)
The story follows three black women who work as “human computers” for NASA in the early 1960’s. “Computer” was actually what they were called; it was a real but low-status job for low-status (female, black) math whizzes in the days before electronic computers, and there were rooms full of them, like steno pools, at NASA. This being Virginia in 1961, our three heroines were relegated even further into the segregated “colored computers” pool. So with the budding Civil Rights movement as backdrop — and this movie excelled at backdrops, with an awesome period score and loads of what looked at least like archival footage — these women broke through racist and misogynist barriers, and got John Glenn into orbit.
And then, just as electronic computers started to threaten their human computing jobs, they figured out how to be the ones to do the necessary work of programming those computers. (It wasn’t in the movie, but programming back then — difficult, exacting, requiring daily brilliance just like now — was another low-status job for “girls.”)
One thing caught me though, not in the story itself but in how the movie was put together. I remember reading once about how some movies were subjected to audience polling, and changes based on that polling, before final release — I wasn’t quite aghast, but it kind of irked me that this was done, and I started seeing what I thought was poll-driven editing everywhere in the movies I watched, and I thought I spotted it here.
There were two (three) parallel stories going on: one (two) involving lowly employee showing them how it’s done, and the other showing the futuristic but inert IBM that NASA purchased being brought to life. The stories were finally brought together, mostly by the juxtaposition of the two “TRIUMPH! THE END” endings, but at one point there seemed to be an aborted attempt at a connection…
The top NASA engineers are trying to figure out some orbital mechanics and realize that they need a different mathematical approach, and Katherine Johnson says “Euler’s Method!” Eureka! But then that’s it: other than a scene where she reads up on the method in an old text, there’s no follow-up. The thing is though, Euler’s method is a numerical method, made up of many simple calculations instead of a few sophisticated ones, and it’s prohibitively impractical as a tool without the electronic computer. I can almost see the missing scenes, where Katherine’s superiors despair of getting the answer in time because there’s just too many calculations, just as Dorothy Vaughan got that old IBM up and running in time to save the day — oh what might have been! …but that’s getting nitpicky, me dreaming up extra scenes, just because I wanted the movie to go on and on.
This movie was morally affirming — righteous even, and patriotic — without being preachy, pro-science without being hokey, and overall a pleasure to watch. Go see it, and see if you don’t applaud too at the end.
I just finished another of my Christmas books, Hillbilly Elegy by J.D. Vance. This was basically the author’s memoir of growing up, in Ohio, as the grandson of Kentucky hill folk who’d moved there looking for a better life, and his struggles with poverty and family dysfunction before his own escape up the socioeconomic ladder. The book has a bit of celebrity status right now, as various blue-state types try to figure out what’s going on in the Appalachian and Rust Belt hinterlands, and what went wrong in the last election…
The first thing I’ll say is the good news: this book is a fast and interesting read, and the author is personable, and engaging if occasionally prone to humble-bragging, and he writes well. Parts of the story reminded me of my own family history, and the class anxieties that come with upward mobility over generations, while other parts were an unsparing look into the darker aspects of his own subculture.
But the bad news is, he never seems to get to the heart of the problems among the Hillbilly Diaspora. He sometimes resorts to church-and-family bromides, and other times seems to warn against the debilitating effects of welfare, but it’s mostly like he’s dancing around a garden variety conservatism. He never really came to any solid conclusion.