My friends are looking to buy an affordable house around Ljubljana. But what are their options, if they want to choose based on commute time? I decided to build a tool to visualise their options.
An isochrone map (isochrone plan, isochrone diagram) in science and urban planning is a map showing areas related to isochrones between different points. An isochrone is defined as “a line drawn on a map connecting points at which something occurs or arrives at the same time” (https://en.wikipedia.org/wiki/Isochrone_map)
Methodology and Technology
I’ve generated a grid of ~40.000 points in Slovenia and calculated travel time to it from a fixed point in Ljubljana Centre. Each point is displayed on a map with radius of 800 meters. It’s a tradeoff between number of points and realistic travel time with a car in a populated area.
For routing and time calculations, I used Project OSRM with OpenStreetMap database of Slovenia. A Python script connected all of this together into a static dataset for the the web site.
I first coded a prototype with Google Maps Directions API. It turns out that 2500 requests/day isn’t enough to make such an application practical.
I then found OSRM and it allowed me to host directions API directly on my computer. It’s also really fast. On a single i7 core, it can do about 40 requests/second. In practice is almost as good as commercial API’s. Based on my tests, the difference of results is about +/- 5 minutes.
What is missing is traffic data. OSRM is returning travel time in optimal traffic conditions. While some of this data is openly available, I’m not sure how to incorporate it. It would also mean that the whole visualisation would need to display the time component too.
I’d like to build a similar version for public transportation – both inside Ljubljana and in the greater Ljubljana region.
It wouldn’t be too hard to make this map dynamic – so you could select your own starting point.
I’ve also discovered that running your own directions API opens up a number of new possibilities. One of them would is potentially adding a layer of routing to Prevoz.org so we could calculate travel time and also suggest rides that pass through your city.
Do you have any ideas?
Let me know in the comments.
I now also have a newsletter so you can be notified when I release something new. Subscribe to it now 🙂.