Visualizing Montreal's Road Network Using Python, Jupyter Notebook and OpenStreetMap
- Zarrin Tasneem
- Aug 3, 2025
- 2 min read
Montreal is a vibrant city with a rich architectural and urban character. Its road network, ranging from bustling highways to quiet residential streets, provides a fascinating canvas for geospatial visualization. In this blog post, I will walk you through how I created an interactive, color-coded map of Montreal’s roads, all using open data and Python.
The Concept
The goal was simple: to build a clean, interactive map that highlights the structure and hierarchy of Montreal’s roads. I wanted highways to stand out boldly, residential streets to fade subtly, and everything to be easily explorable in a web browser or Jupyter Notebook.
To do this, I used OpenStreetMap (OSM) data, streamed directly into Python with the help of OSMnx. I rendered the map using Folium, a powerful library that builds Leaflet.js maps in Python, and applied a smooth color gradient using Matplotlib’s colormap tools.
How It Works
The process involved the following steps:
Downloading road network data for Montreal using the OSMnx library.
Classifying roads by importance, from motorways down to service alleys, based on OpenStreetMap's highwaytag.
Assigning colors dynamically — more important roads received darker, bolder colors, while local streets were rendered with lighter tones.
Rendering everything interactively using Folium, enabling zoom, pan, and hover without the need for saving or exporting the map.
What makes this approach powerful is that everything happens live in the notebook, no file saving, no GIS software, just clean, responsive visualization in the browser.
Why Color and Hierarchy Matter
Colorizing the roads based on their type isn’t just aesthetic, it reveals the structure of the city. Major highways and trunk roads form the skeletal grid, while smaller streets fill in the urban fabric.
Visualizing this hierarchy helps planners, researchers, and data enthusiasts better understand connectivity and density at a glance.
Try It for Your City
The best part? This isn’t limited to Montreal. You can apply the exact same workflow to any city or region in the world from Tokyo to Toronto. It’s a fantastic starting point for urban analytics, transportation modelling, or just exploring the world through the lens of code.



Next Steps
This project opens up exciting extensions:
Add a legend and hover tooltips to explain the road types
Overlay building footprints, parks, or land use zones
Integrate real-time data like traffic volume or cycling routes
Export high-resolution visuals for reports or interactive dashboards
Whether you're doing geospatial research, working on a smart city project, or just learning GIS in Python, this is a powerful and flexible way to start mapping with purpose.




Comments