Coder Social home page Coder Social logo

sin / chronotrains Goto Github PK

View Code? Open in Web Editor NEW

This project forked from benjamintd/chronotrains

0.0 0.0 0.0 630.44 MB

Shortest times between train stations in Europe

Home Page: https://www.chronotrains.com

License: MIT License

JavaScript 1.53% TypeScript 98.30% CSS 0.16%

chronotrains's Introduction

Chronotrains

Chronotrains is an interactive map that allows seeing how far you can travel by train in 5h.

Screen Shot 2022-08-30 at 3 39 18 PM

How does it work?

This map displays isochrones: the area that is reacheable from a starting point in a given amount of time.

This is made possible by building a graph of train stations with the journey durations, and exploring that graph for each station to see which destinations are reacheable in 1h, 2h, ... 5h.

The source data is from the Deutsche Bahn, conveniently wrapped into an API by Direkt Bahn Guru.

Because local transit is not included for most cities, there are no journeys available between different stations that can actually connected by bus, bike, or on foot.

We add edges between those closeby stations (when the distance in less than 10 km), assuming the distance can be traveled at 9 km/h (faster than walking, slower than biking).

After scraping this data, we pre-compute the isochrones. We assume interchanges last 20 minutes. The isochrones are stored as GeoJSON and served on hover.

Technology

This is a Next.js application deployed on Vercel. This allows using the Vercel Edge cache to serve the isochrones fast enough to have a smooth experience.

The mapping library is mapbox-gl.

The data is stored on a Postgres database hosted at Supabase.

The pre-processing is a mix between Node.js scripts and SQL queries. It is currenly triggered by hand and processed locally.

Internationalization

We use next-i18next to translate the app into various languages. If you'd like to contribute a language, you can do so by submitting a Pull Request with a new file in public/locales/[your language]/common.json, and editing next-i18next.config.js to add your locale name.

Cloning the repo

Previous versions of the git history contained all the data committed as static files. For faster cloning, use git clone --depth 1 https://github.com/benjamintd/chronotrains.git.

chronotrains's People

Contributors

abdurrahmanekr avatar alexandruparaschivdumitru avatar benjamintd avatar kimmeiser avatar marcutyo avatar riadhlaabidi avatar sarahmamy avatar sin avatar wardbeyens avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.