Did I mention that I love OpenStreetMap? It’s not just the map that looks more beautiful and complete every day, but also all the neat things it allows people to do with the raw data which is free for anyone to pick up and use. This is not usually something I engage in myself – suum quique – but it does feel good to get your hands dirty with some open data and open source software once in a while.
For me, the reason was that I want a good (looking and functioning) and open bicycle routing application for Amsterdam. There is around 1 million bicycles in this city, and I believe most of those are used every day, but the city lacks a good cycle route planner. There is one attempt, but the app is in flash limiting its usage potential, I find it less than intuitive to use and it’s not open. What I want from a good cycle route planner is
- Allowing users to set parameters for their trip: avoid traffic lights, avoid major roads, go through parks if possible, prefer separate bike lanes over shared lanes; this list can grow. There are many reasons why people get on their bikes; sometimes they’re in a hurry, sometimes they want to enjoy the ride, they might be with kids. A good bicycle routing app should appreciate the different route requirements that ensue.
- Allowing users to determine what information they see on the map so they can make informed decisions. This may include traffic incidents involving cyclists, car traffic intensity, inclines (sic – we have steep bridges!)
- Allowing users to interact with the data and the community. If something is not right or suboptimal in the route returned, offer an easy way to fix the relevant data, or file a bug so someone else can do it. Also: upload GPX tracks which can be used in an aggregated fashion to show preferred routes. Locals to a neighborhood know optimal routes better than cold data, why not leverage that?
- Offering a mobile interface so cyclists can do turn-by-turn routing. A dedicated app that collects track points (think TomTom MapShare) while the app is used would be excellent!
So I wanted to get started with this. At first I looked at OpenRouteService, the OpenStreetMap-based routing service. It is an awesome web application that works really well, both for car and for bicycle and pedestrian routing. The web interface is well done. It has one huge drawback though: the code is not open, so there’s no way to use it in a different application.
I asked around for different solutions, and there proved to be an excellent one, as pointed out to me by main contributor Lambertus: YOURS, or Yet Another OpenStreetMap Route Service. There are several other open solutions – I’m currently looking into BBBike and Routino as well – but YOURS proved to be instantly accessible, and Lambertus was available to help ironing out some setup difficulties. It uses gosmore, another open source project from the OpenStreetMap community, as a routing backend. And the best thing is installation is really a breeze. It is quite well explained on the YOURS wiki page, and involves only a few steps:
- Have a suitable web server environment set up (Linux / Apache / PHP5)
- Download and compile gosmore (instructions on wiki)
- Optionally, retrieve a planet file for the region you’re interested in and convert to gosmore binary format (also well documented)
- Retrieve the YOURS directory from SVN (instructions on wiki) into your apache web directory
- Set some variables in the YOURS config
And basically you’re done. I had some trouble getting gosmore to work, it turned out that I needed to compile it with a HEADLESS option set in the makefile; gosmore has a UI but my server does not have X11, so gosmore croaks. I am still having some trouble connecting to the (also excellent) OpenStreetMap gazetteer service, nominatim, but that has more to do with my rusty PHP and apache skills than anything else. Basically, I have set up my own routing service for the Netherlands, supporting various transportation mode, using open data and open source software, in less than an hour. I find that amazing. The first open, community-supported bicycle routing web application for Amsterdam is born!
A big thanks to Lambertus for helping me out. He does awesome things, providing routable map data for Garmin devices to name but one.