Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

106 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nearest Station Map

How far is my station?

Interactive map showing colored regions for transit stations worldwide. Each colored region represents the area closest to a particular station — hover anywhere to see which station you're nearest to and how far away it is.

Try it live: nearest-station.loessl.org

Example of Stockholm

How it works

The map uses Delaunay triangulation to connect all station points into a triangle mesh, then derives the Voronoi diagram — the dual structure where each cell contains all points closer to its station than to any other. The cells are filled as colored polygons on an HTML canvas overlay.

The same Delaunay structure powers the floating station label: delaunay.find(x, y) locates the nearest station for any cursor position in roughly O(1) time by walking the triangulation, so there's no need to hover precisely on a station dot.

Features

  • Voronoi overlay with toggleable cell borders on top of OpenStreetMap tiles
  • 4 data modes: Subways, All rail (light rail, monorail, tram), Airports, Buses
  • Floating station label with haversine distance to nearest station
  • City search via Nominatim geocoder
  • Explore dropdown with curated cities showcasing interesting patterns
  • Dark mode with CartoDB Dark Matter tiles
  • Copy link to share your current view (lat/lon/zoom/mode preserved in URL)
  • Performance stats overlay with per-phase timing breakdown
  • Fun facts page with data insights and clickable points of interest

Data

Station data comes from OpenStreetMap via the Overpass API. Subway, rail, and airport data is pre-fetched and served as static JSON files. Bus stops are queried live from the current viewport.

Dataset Stations Source
Subways ~18,000 Static, pre-fetched
All rail ~85,000 Static, pre-fetched
Airports ~46,000 Static, pre-fetched
Buses Varies Live Overpass query

Refreshing data

./scripts/fetch-stations.fish

Downloads data from Overpass in 10-degree longitude strips (36 per mode) with retry logic. Skips already-downloaded strips on rerun. The normalization step (scripts/normalize.jq) deduplicates same-name stations within 500m.

Easter egg

There's a hidden developer mode. Try pressing c three times. Or add ?chris=1 to the URL.

Tech stack

License

MIT

About

Creates a colored Voronoi diagram overlaid OpenStreetMaps of closest subway station

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages