OSMnx is a Python library for retrieving, modeling, and manipulating street-network data from OpenStreetMap. It downloads filtered geographic data and returns it as a NetworkX graph. section 3.1
Model a road network with:
- Nodes for intersections, landmarks, or points of interest. section 3.1
- Directed edges for roads and traffic flow, with attributes such as length, speed limit, and capacity. section 3.1
- Routes as sequences of edges connecting an origin to a destination. section 3.1
University of Toronto
Set place_name to "University of Toronto", call ox.graph_from_address(place_name), and plot the resulting campus road network. Add geographic context with folium, including street names, neighborhoods, building footprints, and marked locations. section 3.1
Listing 3.7 University of Toronto example
import osmnx as ox import matplotlib.pyplot as plt place_name = "University of Toronto" graph = ox.graph_from_address(place_name) #1 ox.plot_graph(graph,figsize=(10,10))
Inspect the complete Python example for retrieving and plotting the University of Toronto street network. section 3.1
