Tiny Kathmandu
A small low-poly 3D model of the whole Kathmandu valley that runs in the browser. Nearly 800,000 buildings from open map data, 42 hand-modelled landmarks, and the valley's real time, weather and air. Walk it, drive it, sail its rivers or fly over it. Built with three.js and a Python data pipeline.
About
Tiny Kathmandu is the Kathmandu valley as a miniature you can hold in a browser tab. Streets, rivers, temples and rooftops come from open map data. The sky follows Kathmandu’s real clock, weather and air quality, and live flights come in to land at Tribhuvan.
You can explore the whole valley from above, with Kathmandu, Patan and Bhaktapur in detail, or drop down to street level. Walk the gallis, drive a taxi, Sajha bus or Safa Tempo, row a dunga down the river, or fly a helicopter, a turboprop, a paraglider or a pigeon. It works in English and Nepali, on desktop and on phones.
What I built
- A Python pipeline that turns OpenStreetMap, Overture buildings and places, measured heights and elevation tiles into compact binary files with a documented format
- A three.js client with no UI framework that streams the city in chunks around the camera and builds geometry in web workers
- 42 landmarks modelled in code, from the Durbar Squares and stupas to Dharahara and the airport, with a review page and tests for geometry, materials and search aliases
- A live sky: sun position, weather, clouds, haze and lit windows at night, from Open-Meteo
- Live aircraft through a Cloudflare Worker that proxies open ADS-B feeds and caches them at the edge
- Walk, Drive, Sail and Fly modes with their own physics, activities, HUDs and sound, plus a photo mode with tilt-shift and postcard frames
- Search over about 4,000 places in English and Nepali that forgives typos, a 14-stop tour, and a Valley Passport for stamping landmarks
Engineering decisions
- Bake once, stream small. All the map processing happens ahead of time. The browser only reads gzip-packed binary files described in one contract file, so the pipeline and the client can change independently as long as both follow it.
- Compress for the data, not just with gzip. Terrain heights are stored as differences from their neighbours, split into byte planes, before gzip. Long runs of small numbers compress far better than raw heights. Production files are content-hashed so they can be cached forever.
- Detail follows the camera. Buildings, trees, roof clutter and fine terrain load in a radius around the camera, and that radius shrinks at street level, where you can’t see past the first row of houses anyway.
- Quality adapts to the device. Rendering starts at full quality and steps down while frames stay slow, then back up when there is headroom, so an old phone still gets a working city.
- Landmarks in code, not model files. Every temple and vehicle is built from code, which keeps the download small and lets a test suite check every model.
- One request for everyone. Live flights go through a Worker that caches the upstream feed for 8 seconds at the edge, so all visitors share one request to the free ADS-B services.
Stack
TypeScript, three.js and Vite in the browser, with web workers for geometry. Python with uv for the data pipeline. Cloudflare Workers for hosting and the flights API. Data from OpenStreetMap, Overture Maps, Google Open Buildings, AWS Terrain Tiles, Open-Meteo and adsb.lol.