Check out the journal article about OSMnx.
How far can you travel on foot in 15 minutes? Urban planners use isochrone maps to show spatial horizons (i.e., isolines) that are equal in time. Isochrones depict areas according to how long it takes to arrive there from some point. These visualizations are particularly useful in transportation planning as they reveal what places are accessible within a set of time horizons.
We can create isochrone maps for anywhere in the world automatically with Python and its OSMnx package:
This travel time map shows how far we can walk in 5, 10, 15, 20, and 25 minutes from an origin point in downtown Berkeley, given an average walking speed of 4.5 km/hour (about 2.8 miles/hour). We can also visualize this by which points along the network we can reach within 5, 10, 15, 20, and 25 minutes:
You can create your own travel time maps for any city in the world by following this example in the OSMnx usage examples GitHub repo. OSMnx is a Python package for easily downloading, analyzing, and visualizing OpenStreetMap street networks anywhere in the world. Installation instructions are on GitHub.
If you’re interested in routing, travel times, and imputing road speeds, make sure to check out OSMnx’s new speed module.
19 replies on “Isochrone Maps with OSMnx + Python”
This is magnificent… the easiest open-source implementation of isochrones for street networks that I’ve tried.
I’m trying to figure out if there is a straightforward way of calculating the travel times to each individual node and then exporting these for use in something like Arc?
Yes. You need to put a travel time attribute on each edge, like in the example here. Then run networkx.shortest_path, providing a source node but not a target node (this will calculate shortest paths from the source node to every node in the graph). Finally, sum the travel time attributes of the edges that compose each path.
Thanks – I managed to work this one out in the end and it worked very nicely apart from a couple of locations where the nearest node to my point of interest wasn’t well-connected to the network.
Only issue I have left is that the walk network definition is quite stringent so it leaves out OSM ways that are not primarily walk, e.g. A cycleway that permits foot access such as this:
https://www.openstreetmap.org/way/5364004
I guess that downloading all-private will fix this issue.
This has really introduced me to the powerful things you can do with Python & GIS – I hadn’t done any GIS with Python before…
Beautiful work, I recommend you study modern Italian architecture.
A balanced contrast between nature and urbanism.
I’ll be getting better, I imagine if you use a drone to make the images!
Congratulations
Hi Geoff,
Let me echo everyone by saying this truly awesome and beyond helpful. I am certainly going to incorporate in my work-flow. Just one quick question..how would I export the data from osmnx to a .shp or kml? Thank you very much for your work on this!
To save a network from OSMnx to shapefile: https://osmnx.readthedocs.io/en/stable/osmnx.html#osmnx.save_load.save_graph_shapefile
Is there a way of saving the isochrone polygons to a shapefile? I tried the save.load functions but couldn’t get it to work.
How to save pois_from_place() result to shapfile?
gdf = ox.pois_from_place(place=’Kamppi, Helsinki, Finland’)
ox.save_gdf_shapefile(gdf,’gdf’)
throw error:
ValueError: All geometries in GeoDataFrame must be shapely Polygons or MultiPolygons
I stumbled upon the demonstration notebook by chance and asked myself if there is a way to pass the program a given center point instead of having osmnx calculate the centermost node. The Node closest to the given coordinates would be the center then. Having walking distances ploted fro certain POIs like railway station ea. seems useful. Can You point a direction?
Sure. You can pick any node ID to calculate distances around it. You can also pass any lat-long coordinates, find the nearest node, and use that. More in the documentation: https://osmnx.readthedocs.io/en/stable/
Geoff, are you able to provide an example of how I would select a node (or an address) rather than a polygon and run the isochrones from this point? Sorry, I am new to python.
Don’t worry. I have figured it out.
osmnx.core.graph_from_address in here https://osmnx.readthedocs.io/en/stable/osmnx.html#module-osmnx
Great work. Great work. Unfortunately I have no background with Python but at this moment I see a lot of opportunities. Above text is focused on generate isochrones form one point. Could you tell what is difference if I would like to do analysis e.g for bus stops in the city?
Hi,
Is there an easy way to calculate the OD matrix (travel time) from the census tract centroid to other census tracts centroids? Thank you!
Hi Geoff,
Really nice work!
Do you have any idea whether these libraries can handle and draw much longer isochrones? E.g. 20–40 hour driving time from some locations in Europe?
Do you calculate node traversal times for vehicle-based routing? For example, I’d like to calculate the fastest driving route which takes into account approximate times for right- and left-hand turns.
Not built into the package. You’d have to calculate these impedances yourself, then use them as a shortest-path weight.
[…] far can you travel on foot in 15 minutes? Urban planners use isochrone maps to show spatial horizons (i.e., isolines) that are equal in time. Isochrones depict areas according […]
Hi – Thank you for your great work. Is there a way to calculate Isochrones more precisely by adding nodes to the graph when necessary (i.e. adding a node in a street to match exact distance). Is it also possible to save the isochrone to an Iframe ?