OpenStreetMap is a crowdsourced geographic database containing worldwide map and location data. In graph applications, road-network nodes represent intersections or points of interest, while directed edges represent roads and may store length, speed limits, and capacity. section 3.1
Use OpenStreetMap with Python to:
- Retrieve filtered geographic data through OSMnx as a NetworkX graph. section 3.1
- Convert a place description such as “University of Toronto” into a road-network graph. section 3.1
- Display roads, streets, neighborhoods, building footprints, and points of interest with folium. section 3.1
Campus route data
A campus route can model the King Edward VII equestrian statue and the Bahen Centre for Information Technology as locations connected by road-network edges. OSMnx retrieves the surrounding graph, while folium places the points on an interactive map. 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 a compact Python example that retrieves and plots the University of Toronto road network with OSMnx. section 3.1
