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:

  1. Download and model OpenStreetMap street networks as graphs.
  2. Compute network-based distances and service areas.
  3. Perform spatial joins between amenities and reachable areas.
  4. Combine metrics into a transparent walkability score.
  5. Visualize results with isochrone rings and points.
  6. 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

  1. Network Distance
    • Walking distance is constrained by the street graph.
    • Shortest path algorithms (Dijkstra) operate on nodes and edges.
  2. 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.
  3. Amenity Accessibility
    • You care about amenities within 5, 10, 15 minutes.
    • Counts should be normalized to avoid scale bias.
  4. 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

  1. Convert the graph to a projected CRS.
  2. Compute travel time on each edge (distance / walking speed).
  3. Run shortest paths from a center node.
  4. Extract nodes within time thresholds.
  5. 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

  1. Download walking network using OSMnx.
  2. Build 5, 10, 15 minute isochrones.
  3. Query amenities by OSM tags (parks, cafes, transit).
  4. Spatially join amenities into isochrones.
  5. Compute a final walkability score with clear weights.
  6. 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:

  1. A base map centered on the neighborhood.
  2. Three colored isochrones (5, 10, 15 min).
  3. Amenity points with a legend.
  4. 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

  1. Download network graph for the region.
  2. Convert graph to projected CRS.
  3. Compute edge travel times.
  4. Run shortest path from center node.
  5. Build isochrones for 5/10/15 minutes.
  6. Spatially join amenities to isochrones.
  7. 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

  1. Street Graphs
    • Nodes, edges, and weights.
  2. Isochrones
    • Converting network reachability to polygons.
  3. Spatial Joins
    • Counting points in polygons.

Questions to Guide Your Design

  1. Which amenities should count the most?
  2. How will you normalize counts across neighborhoods of different sizes?
  3. What walking speed will you assume?
  4. 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

  1. Why is network distance more realistic than Euclidean distance?
  2. What is an isochrone and how is it computed?
  3. How does CRS affect distance measurements?
  4. How do you build a walkability score that is not biased by size?
  5. What are limitations of OSM data?
  6. 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.