explaingit

gboeing/osmnx

5,671PythonAudience · researcherComplexity · 2/5LicenseSetup · easy

TLDR

A Python package for downloading and analyzing real-world street networks and geographic data from OpenStreetMap, find shortest paths, study city road layouts, and map points of interest in a few lines of code.

Mindmap

mindmap
  root((osmnx))
    What it does
      Download street networks
      Analyze road graphs
      Map geographic data
    Data types
      Road networks
      Points of interest
      Building footprints
      Transit stops
    Analysis
      Shortest path finding
      Network connectivity
      Street orientation
      Travel time calc
    Audience
      Urban researchers
      Data scientists
      Urban planners
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Download the walkable or drivable street network for any city and find the shortest path between two locations

USE CASE 2

Analyze how connected a neighborhood's road layout is and compare it to other cities

USE CASE 3

Visualize the compass orientation of streets in a city as a polar histogram chart

USE CASE 4

Map all parks, shops, or transit stops from OpenStreetMap within a given geographic area

Tech stack

PythonNetworkXGeoPandasMatplotlib

Getting it running

Difficulty · easy Time to first run · 5min

Published research work that uses OSMnx data must include OpenStreetMap attribution as required by the ODbL license.

Use freely for any purpose including commercial use, as long as you keep the copyright notice (MIT license).

In plain English

OSMnx is a Python package for downloading, modeling, analyzing, and visualizing street networks and other geographic features from OpenStreetMap. OpenStreetMap is a free, community-built map of the world, and OSMnx gives Python users a way to pull data from it and work with it programmatically without needing to handle the raw data format yourself. The core use case is street networks. With a single line of Python code you can download the road network for a city or neighborhood, configured for walking, driving, or cycling. The result is a network graph, which is a data structure that represents intersections as nodes and streets as edges between them. You can then run analysis on that graph, such as calculating distances, finding shortest paths, or measuring the connectivity of the road layout. Beyond road networks, OSMnx also handles other types of geographic data that OpenStreetMap contains: points of interest like shops and parks, building footprints, transit stops, and elevation information. It includes tools for calculating travel times and speeds on routes, and for visualizing street orientations as a compass-rose chart. The package is built for researchers, urban planners, and data scientists who study cities and transportation. It has an associated academic paper published in Geographical Analysis in 2025 and is frequently used in academic work, which means it expects users to cite that paper when using it in research. Installation is covered in its documentation, and a separate examples gallery provides step-by-step tutorials. The package is open source under the MIT license, though users who publish work using OpenStreetMap data need to include proper attribution to OpenStreetMap, as required by its open data license.

Copy-paste prompts

Prompt 1
Write Python code using OSMnx to download the walkable street network for Manhattan and find the shortest walking path between two addresses
Prompt 2
How do I use OSMnx to download all coffee shops within 1km of a location and plot them on a map?
Prompt 3
Show me how to calculate street orientation for a city using OSMnx and visualize it as a compass-rose polar bar chart
Prompt 4
Use OSMnx to download the bicycle network for Amsterdam and compute network stats like average node degree and edge density
Prompt 5
How do I add elevation data to an OSMnx street network and use it to find the flattest walking route?
Open on GitHub → Explain another repo

← gboeing on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.