liveBook · Manning

OpenStreetMap

As explained in Optimization Algorithms: AI techniques for design, planning, and control problems

OpenStreetMap is a crowdsourced geographic database containing worldwide map and location data.

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

How Optimization Algorithms: AI techniques for design, planning, and control problems covers it

How deep it goes
Defines the database and demonstrates retrieval and visualization, but does not detail route-calculation algorithms.
Examples
Uses the University of Toronto, its St. George campus, campus landmarks, roads, and mapped points of interest.
What it assumes
Teaches nodes, edges, directions, and routes through road-network examples while using Python graph libraries.
What you can do after
Apply OSMnx and folium to retrieve, represent, plot, and annotate a place-based road network.
How it connects
Connects geographic data with graphs, road networks, NetworkX, OSMnx, folium, and points of interest.

This explainer was generated by Manning's knowledge graph from the text of Optimization Algorithms: AI techniques for design, planning, and control problems. The section links point to the parts of the book it draws on.