Tutorial 13: Geographical networks

In this tutorial we will learn how to download a map from the Open Street Map project and make some analysis of it.

Open Street Map

Open Street Map is a project of a community map. Everyone can update the map (contributions are usually checked by editors) and the resulting map is free for everyone.

OSMnx package

OSMnx is a Python package to retrieve, model, analyze, and visualize OpenStreetMap street networks as NetworkX MultiDiGraph objects. See https://osmnx.readthedocs.io/ for OSMnx documentation and usage. You will need to install this package using pip install osmnx.

Obtaining map data

You can obtain graph from the map by using function graph_from_point where the first parameter is tuple of coordinates, parameter dist=x says that you want a map in distance of $x$ meters around the given coordinate and then you can choose network_type, where you can specify whether you are interested in paths for cars, bikes or pedestrians.

Calculating speeds and travel times

Module speed of osmnx alows you to have maximal allowed speeds on a given road as edge attributes in you map network. Also, travel times can be computed based on these speeds and lenghts of the edges.

The function graph_from_point returns MultiDigraph. There is a function get_digraph which allows you to convert the MultiDiGraph to DiGraph. You have to specify which of the parallel edges should be preserved by setting weight parameter to an edge attribute.

Plotting the map

The osmnx package has module plot with functions get_node_colors_by_attr allowing to color nodes according to node values and plot_graph allowing you to plot the obtained graph. See the documentation for usage: https://osmnx.readthedocs.io/en/stable/osmnx.html?highlight=add_edge_speeds#module-osmnx.plot

Tasks

Task 1: In the map of car roads in the 2km surrounding of Malá Strana, compute the node betweenness centrality normalized by the travel times and draw the result.

Task 2: Do the same thing for bike and pedestrian paths and analyse the results.