Project 2: Neighborhood Walkability Analyzer
Build a tool that scores neighborhood walkability using street networks, isochrones, and amenity proximity.
Quick Reference
| Attribute | Value |
|---|---|
| Difficulty | Intermediate |
| Time Estimate | 1-2 weeks |
| Language | Python |
| Prerequisites | GeoPandas basics, graph fundamentals |
| Key Topics | OSMnx, network distance, isochrones, spatial joins |
| Output | HTML map + score report |
Learning Objectives
By completing this project, you will:
- Download and model OpenStreetMap street networks as graphs.
- Compute network-based distances and service areas.
- Perform spatial joins between amenities and reachable areas.
- Combine metrics into a transparent walkability score.
- Visualize results with isochrone rings and points.
- Explain why network distance beats straight-line distance.
The Core Question You’re Answering
“How walkable is this neighborhood when you measure what a person can reach on real streets?”
Walkability is not about how many amenities exist, but how accessible they are along actual paths. This project makes that distinction concrete.
Concepts You Must Understand First
| Concept | Why It Matters | Where to Learn |
|---|---|---|
| OSM data model | Streets and amenities are modeled as nodes/ways | OSMnx docs |
| Network distance | Shortest path over graph, not Euclidean | Graph theory basics |
| CRS/projection | Distance requires projected coordinates | GeoPandas CRS guide |
| Spatial joins | Count amenities in polygons | GeoPandas user guide |
| Isochrones | Areas reachable within time | OSMnx examples |
Key Concepts Deep Dive
- Network Distance
- Walking distance is constrained by the street graph.
- Shortest path algorithms (Dijkstra) operate on nodes and edges.
- Isochrones
- An isochrone is the polygon of points reachable within a time budget.
- It is derived by selecting nodes within a time threshold and polygonizing.
- Amenity Accessibility
- You care about amenities within 5, 10, 15 minutes.
- Counts should be normalized to avoid scale bias.
- Scoring Models
- A score should be transparent and weighted.
- Example weights: 40 percent amenities, 30 percent intersection density, 30 percent transit proximity.
Theoretical Foundation
Walkability as a Network Problem
Amenities (points)
|
v
Street Graph (nodes/edges) -> Shortest paths -> Isochrones -> Counts -> Score
Why CRS Matters
OSM data is in WGS84 (lat/lon). Distance calculations must use a projected CRS (like a local UTM zone) or your distances will be wrong.
Isochrone Construction
- Convert the graph to a projected CRS.
- Compute travel time on each edge (distance / walking speed).
- Run shortest paths from a center node.
- Extract nodes within time thresholds.
- Create polygons from those nodes.
Project Specification
What You Will Build
A tool that accepts a neighborhood or lat/lon center, computes walkability metrics, and outputs a score plus a map of reachable areas and amenities.
Functional Requirements
- Download walking network using OSMnx.
- Build 5, 10, 15 minute isochrones.
- Query amenities by OSM tags (parks, cafes, transit).
- Spatially join amenities into isochrones.
- Compute a final walkability score with clear weights.
- Render an HTML map with isochrones and points.
Non-Functional Requirements
- Accuracy: Use projected CRS for distance.
- Transparency: Print scoring formula and inputs.
- Reproducibility: Cache OSM downloads.
Example Usage / Output
$ python walkability.py --place "Berkeley, CA" --center "37.8715,-122.2730"
Walkability score: 82/100
Amenities within 10 min: 145
Map saved to output/berkeley_walkability.html
Real World Outcome
Open output/berkeley_walkability.html and you see:
- A base map centered on the neighborhood.
- Three colored isochrones (5, 10, 15 min).
- Amenity points with a legend.
- A summary box showing the walkability score and component metrics.
Solution Architecture
High-Level Design
OSM Data -> Graph -> Isochrones -> Amenity Join -> Score -> Map
Key Components
| Component | Responsibility | Key Decisions |
|---|---|---|
| Network builder | Download street graph | Walk vs drive network |
| Isochrone engine | Reachable polygons | Time thresholds |
| Amenity fetcher | Query POIs | Tag selection |
| Scorer | Normalize metrics | Weighting scheme |
| Renderer | Map output | Folium styling |
Data Structures
networkx.MultiDiGraph # street graph
GeoDataFrame # amenities and isochrones
Algorithm Overview
- Download network graph for the region.
- Convert graph to projected CRS.
- Compute edge travel times.
- Run shortest path from center node.
- Build isochrones for 5/10/15 minutes.
- Spatially join amenities to isochrones.
- Normalize metrics and compute score.
Complexity
- Shortest path: O(E log V)
- Spatial join: O(n log n)
Implementation Guide
Development Environment Setup
python -m venv geo-env
source geo-env/bin/activate
pip install osmnx geopandas folium
Project Structure
project-root/
├── src/
│ ├── walkability.py
│ ├── isochrones.py
│ └── scoring.py
├── output/
│ └── walkability.html
└── README.md
The Core Question You’re Answering
“How do I quantify walkability using real street access, not just straight lines?”
Concepts You Must Understand First
- Street Graphs
- Nodes, edges, and weights.
- Isochrones
- Converting network reachability to polygons.
- Spatial Joins
- Counting points in polygons.
Questions to Guide Your Design
- Which amenities should count the most?
- How will you normalize counts across neighborhoods of different sizes?
- What walking speed will you assume?
- How will you avoid bias toward large areas?
Thinking Exercise
Pick two neighborhoods. List amenities within 1 km straight-line distance and compare to network distance. Which changes more and why?
Interview Questions
- Why is network distance more realistic than Euclidean distance?
- What is an isochrone and how is it computed?
- How does CRS affect distance measurements?
- How do you build a walkability score that is not biased by size?
- What are limitations of OSM data?
- How would you scale this for a whole city?
Hints in Layers
- Hint 1: Start with one amenity category (parks).
- Hint 2: Cache the graph to avoid repeated downloads.
- Hint 3: Visualize isochrones alone before adding points.
- Hint 4: Normalize metrics by area or by maximum counts.
Books That Will Help
| Topic | Book | Chapter |
|---|---|---|
| OSMnx | Boeing paper | Methods |
| CRS | “Python for Geospatial Data Analysis” | CRS chapter |
| Spatial joins | GeoPandas guide | Joins |
Implementation Phases
Phase 1: Data Acquisition (2-3 days)
- Download network graph and amenities.
- Plot network and POIs.
Checkpoint: Graph and POIs are visible on a map.
Phase 2: Isochrones (3-4 days)
- Add travel time weights.
- Generate isochrones for 5/10/15 minutes.
Checkpoint: Isochrone polygons render correctly.
Phase 3: Scoring and Reporting (2-3 days)
- Count amenities per isochrone.
- Compute score with weights.
- Render final map.
Checkpoint: Score is computed and displayed.
Key Implementation Decisions
| Decision | Options | Recommendation | Rationale |
|---|---|---|---|
| Network type | walk, drive | walk | Matches goal |
| Walking speed | 4 km/h, 5 km/h | 4.5 km/h | Balanced default |
| Scoring | weighted sum | weighted + normalization | Comparable across regions |
Testing Strategy
| Category | Purpose | Examples |
|---|---|---|
| Graph build | Valid network | Node/edge counts |
| Isochrones | Valid polygons | Non-empty geometry |
| Scoring | Range check | Score between 0-100 |
Critical cases:
- Sparse neighborhoods with few amenities.
- Dense downtown areas with many amenities.
- Missing OSM tags.
Common Pitfalls and Debugging
| Pitfall | Symptom | Solution |
|---|---|---|
| Wrong CRS | Distances off | Project to local CRS |
| Huge area | Slow computations | Limit region size |
| Overweighted metric | Extreme scores | Normalize and cap |
Extensions and Challenges
- Compare two neighborhoods side by side.
- Add transit-based isochrones.
- Add a web UI for interactive scoring.
Real-World Connections
- Urban planning and transit design.
- Real estate neighborhood comparisons.
- Accessibility studies and policy.
Resources
- OSMnx docs: https://osmnx.readthedocs.io/
- GeoPandas: https://geopandas.org/
- OpenStreetMap: https://www.openstreetmap.org/
Self-Assessment Checklist
- I can explain how isochrones are built.
- I can justify my scoring model.
- I can produce a clean map with readable layers.
Submission / Completion Criteria
Minimum Viable Completion
- Isochrones computed and basic score produced.
Full Completion
- Amenities joined and score explained.
Excellence
- Multi-neighborhood comparison and UI.
This guide was generated from GEOSPATIAL_PYTHON_LEARNING_PROJECTS.md. For the complete learning path, see the parent directory GEOSPATIAL_PYTHON_LEARNING_PROJECTS/README.md.