A web application that calculates how many people live within X minutes travel time from a selected location in Europe.
- Frontend: Next.js 14+ (React + TypeScript), MapLibre GL JS, Tailwind CSS
- Backend: Python FastAPI
- Database: PostgreSQL + PostGIS
- Population Grid: Eurostat/GISCO Census grid 2021
- Isochrones: OpenRouteService (ORS) public API
- Map Tiles: OpenStreetMap
- Node.js 18+ and npm/yarn
- Python 3.10+
- Docker and Docker Compose
docker-compose up -dThis will start PostgreSQL with PostGIS extension.
cd backend
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txtCreate backend/.env:
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/population_db
ORS_API_KEY= # optional, public API works without key
Initialize database (creates tables and enables PostGIS):
python -m app.db.init_dbRun backend:
uvicorn app.main:app --reload --port 8000Backend API will be available at http://localhost:8000 (docs at http://localhost:8000/docs)
cd frontend
npm installCreate frontend/.env.local:
NEXT_PUBLIC_API_URL=http://localhost:8000
Run frontend:
npm run devVisit http://localhost:3000
.
├── backend/ # FastAPI backend
│ ├── app/
│ │ ├── main.py # main application entry
│ │ ├── api/ # api endpoints
│ │ ├── db/ # database setup
│ │ └── services/ # business logic
│ └── requirements.txt
├── frontend/ # Next.js frontend
│ ├── src/
│ │ ├── app/ # app router pages
│ │ └── components/ # react components
│ └── package.json
└── docker-compose.yml # database setup
- ✅ Phase 0: Basic skeleton - COMPLETE
- ✅ Phase 1: Isochrone generation via ORS API - COMPLETE
- Phase 2: Population grid data ingestion (next)
- Phase 3: Spatial intersection and calculation
- Phase 4: Frontend integration
- Phase 5: Optimization and caching
The application now generates isochrones from any location using the OpenRouteService API.
What's working:
- Interactive map with location selection
- Isochrone visualization (blue shaded area on map)
- Support for walking, cycling, and driving modes
- Travel time range: 5-60 minutes
- Intelligent caching to reduce API calls
Try it:
- Keep backend running (
uvicorn app.main:app --reload) - In new terminal:
cd frontend && npm install && npm run dev - Visit http://localhost:3000
- Click any location, select mode/time, click "Calculate Population"
- Watch the isochrone appear!
Phase 2 loads the Eurostat population grid into the database.
Quick Start:
- See
PHASE2_INSTRUCTIONS.mdfor detailed steps - See
backend/DATA_SOURCES.mdfor download links - Install dependencies:
pip install geopandas pandas - Download data from GISCO
- Run:
python scripts/ingest_population_data.py --file path/to/data.gpkg
Or skip for now: I can implement Phase 3 with test data so you can see it working end-to-end!
See PHASE1_COMPLETE.md for Phase 1 technical details.
MIT