Gosh. I’m going to do one of those academic blog posts where I self-promote by telling you that I’ve just published a paper and that you should go read it. I hate those. But, I had actually been meaning to make my thoughts into a blog post or two, and without the intervention of my academic advisor at the time, I would have; now the thing is a paper instead of a post, a full year after it would have been a post, and have I mentioned that you should read it? It’s about bike maps, and what I hate about bike maps and how I attempted to make them better as a genre, by example, and then by overly formal peer-reviewed explication.
The paper is in Cartographic Perspectives which is the journal of the very cool North American Cartographic Information Society who’s conference I attended last year. Cool people. Very friendly. If anyone out there is considering being a cartographer in North America, I recommend you do it, and not just for the conferences and open access journals.
P.S. Here is a link to the article PDF just in case the above link breaks when the issue gets published.
I said when I was working on the bike map that I would get around to publishing the ‘source code’, and now that I’m preparing to leave the city, I feel I ought to finally do that. So! The basic idea of this post will be a step by step instruction for how to make yourself (or your city) an updated Cincinnati Bike Map. Strictly speaking, this will work for other cities too, but please note that the map was designed for Cincinnati in 2014 and other cities in other times, with different (data) structures may simply not work well at all.
Let’s get started!
Step 1: Get the software you’ll need: QGIS, PostGIS(a PostgreSQL extension), osm2pgsql, osm2po, GRASS, PHP(for one of the scripts), and Inkscape and GIMP for the final layout. All are free and open source and run on Linux (but probably other things too).
Step 2: Update the data! A big and important step. The vector data is all from OpenStreetMap and the process of editing OSM is well documented elsewhere, so I needn’t go into it at all here.
Step 3: Go to OpenStreetMap and navigate to the area you want to download. Be generous and include at least ten extra miles on all sides of the map you’ll be making. Click the ‘export’ tab and use the ‘Overpass API’. It will prompt you to download a large .osm XML file to your computer.
Step 4: Import that data into a PostGIS database twice: once with osm2pgsql and once with osm2po. The first will bring in the OSM data as-is, with as many tags as you care to import. To do it the way I did it, you should use this osm2pgsql.style file. The second one, osm2po will slice the linear path data (the streets and stuff) into a table of routable nodes and edges. For that one, you may want to try this configuration file. If that doesn’t work, the real point of it is to include paths that bikes can use (paths, pedestrian streets, stairs, etc), which are not included by default, while leaving out the rest.
Step 5: Process the data from osm2pgsql using this SQL script. It does quite a few things, including setting (short) street labels, calculating speed in mph, setting default speeds and lane-counts for no-data streets, identifying landmark buildings, and pulling a number of features into a consistent format for better/easier rendering.
Step 6: Run this SQL script to merge the two tables you’ve imported into one table that is both routable and has all of the important attributes/tags from OSM.
Step 7: Run tarjan.php on the new/duplicate segments table. This script uses Tarjan’s Algorithm to identify edges that connected at both ends to the main street network, and those that are not, leaving the results in a boolean field on that table.
Step 8: Once the dangling edges are identified, run this SQL script to drop the minor paths that go nowhere. Major dead-ending streets will be kept. Things like driveways will be dropped.
Step 9: Get the elevation data. I used data from the USGS (use their national map tool to download). I found that of the two decent resolutions available, one was too course (I could see pixels) and the other was too fine (I could see buildings). I chose to smooth out the finer data, using a neighborhood average in GRASS. I suppose you could also go at that the other way though too, increasing the resolution and then smoothing. The point is to get an amount of detail that just looks right and doesn’t have any visible pixelation: use your gut!
Step 10: Now you have all the data ready to go in your PostGIS database, and you just need to drop it into QGIS and style it. I wish things were easy enough that I could share a simple stylesheet with you; the way QGIS does it, the style information is all bound up with information about the table. That means that if your table/database/column/everything names are different from the ones I used, you’re going to have trouble making this run smoothly. In the interest of giving something here though instead of nothing, I’ll link to the QGIS map files used to render the main and inset maps (hills, transit, and trails). These may not be directly useful, but you could look at them as XML files, and see precisely how things were styled including line widths, hex colors, etc. It may also be useful to sample colors directly from the digital version of the map using something like GIMP. Once ready, export these maps as 300+DPI rasters using the following templates: main map, 1/3 scale inset maps.
Step 11: Now we have the base maps, we’re finally ready for the layout! I did the layout in Inkscape SVG, linking to the exported raster maps which I placed in an adjacent directory. You’ll have to re-link those, but the frames should still be in the right position.
Step 12: Profit.
Well, that’s about the gist of it. … I don’t actually think that hardly covers it, but there’s not enough time in the world to document everything for an uncertain future that may or may well not contain good bike maps. And anyway, I don’t expect anyone to slavishly duplicate my approach. We’ll call it a limited edition ;-)
If someone does actually want a real update though, I’m always available to answer questions, or if you’re the type to cut right to the chase, for hire. Email me!
So far I know for a fact that bike maps have been dropped off in the following locations, though I’m certain there are others:
- Spun Bicycles, Northside
- Reser Bicycle Outfitters, Newport
- SORTA and TANK (downtown store in the Mercantile Center, also handing them out at events)
- Cincinnati Chamber of Commerce (HYPE, etc)
- City of Cincinnati Bicycle program (City Hall, handing them out at events)
- Red Bike bike share
- Campus Cyclery, Clifton Heights
- Smitty’s Cyclery, Mariemont
- DAAP, various places around the building
- Green Umbrella (handing them out at events)
- Coffee Emporium, Downtown
- Rohs St Cafe, Clifton Heights
- Groundwork Mill Creek
- Park & Vine, OTR
- UC Blue Ash Campus
- UC Tangeman University Center, main entrance, with the transit schedules near the ATM
- Queen City Bike (handing them out at events)
- UC Geography Department (fourth floor Braunstein Hall)
- UC Bike Kitchen
- The North American Cartographic Information Society (NACIS) 2014 annual meeting, Pittsburgh :-P
- Crazy Fox Saloon, Newport
- Habanero, Clifton
- Iris Cafe, OTR
- BunkHaus hostel, OTR
- Roebling Point Books, Covington
- Rock Paper Scissors, OTR
- OTR community Council
- Sitwell’s, Clifton
- Fountain Square Booksellers
- Fountain Square visitor information center
I’ll keep adding to this list as I carry maps out the door. Check back! And as I said before, I’m happy to send a couple in the post if I haven’t made it to your neighborhood yet — or even if you’re out of town. Just send me an email with your address.
The bike maps are coming! the bike maps are coming!
Shout it out your windows, from the rooftops, the bike maps are coming!!
Dear lordy I spent too much time on this project. But they’re here! Well, I have a handful of them as I write this, the rest of my little pannierful having been handed around the UC Geography Department this morning.
Sometime later today or tomorrow, I’m taking delivery from the printer of two pallets of boxes, together about the volume of a loveseat. A loveseat of maps. Eventually all of these boxes will leave my little apartment, which has no room for a loveseat, balanced either on wheels or feet. They’ll find their way out into your bicycle shops, your bars, your universities, your coffee parlours, your city, your chambers of commerce, into, I say, your very souls.
If anyone wants to save me the effort and accept some bike maps right now before I come knocking then throwing bike maps at your bedroom windows in the middle of the night, I’ll be very glad to deliver or ship, depending on how close y’all are. Just send me an email with your name and address and how many you want. I can send one just for you, or a whole box if you want to hand them out to your customers, cycle club, etc. Shipping or delivery is free! These are free bike maps! And there are plenty enough to go around! Please do not hesitate to ask for some! Get extras. Take some into the office. Take some to your church. The next time a bum asks you for bus money, hand them a bike map and say: Haven’t you heard man? Bikes are the thing now!
For indeed they are.
So much time talking about the bike map, so little time showing what I’ve actually been working on. Usually it’s the other way around: all showing, no talking. I thought I might wet the collective hydrostat, prior to it’s ultimate aid of more thorough public digestion, with something that my more tiresome colleagues might call an image which conveys brand equity.
Soothing or perhaps jarring colours, a sense of immediate tangibility, not less than a touch of fetishism. The object or better it’s image becomes a site of worship. White-balance is of the utmost importance. Perhaps I’ve been in DAAP too long already today? Perhaps I shouldn’t work in this library any more.
But just look at that underscoring shadow!
On a less sarcastic tone, I’ve finally finished a task of which I’m rightly proud, which no one knew I was doing: detecting dead-ends successfully after a four day expedition into graph theory. Robert Tarjan is the guy to thank here, and the Wikipedia editors who tediously provided a pseudo-code implementation of his algorithm for the detection of strongly connected network components. The bike map will emphasize only one strongly connected network component, the biggest one, and all the rest will be damned to transparency!
Or more simply, the idea is to deemphasize streets which don’t go anywhere. There are a surprising number of them!
The goal right now is to have the map on the presses by the end of July, to be distributed near the end of August when I return from vacation. I’ve got a little surveying and data entry left for me in the days ahead, and then the big crunch as I finalize the layout and systematically double-check important features.