DEV Community

Pingwi
Pingwi

Posted on

Building an interactive map of sleeper trains πŸš†

Night trains are having a bit of a comeback in Europe, but finding out where you can actually go by sleeper train is still surprisingly difficult.

There are plenty of railway websites, timetables and booking platforms, but I wanted something much simpler:

1) open a map
2) click a station
3) see the direct overnight trains from this station

So I started building Sleeper Train Map, an interactive map showing sleeper and night train connections across Europe.

https://pingwi.com

How it works

The map displays overnight train routes and their stops. You can click a station and see the sleeper destinations available from there.

For example, instead of searching separately for:

Amsterdam β†’ Vienna
Amsterdam β†’ Berlin
Amsterdam β†’ Zurich

you can simply look at Amsterdam on the map and see the overnight connections from that point.

The interesting part is the data

The UI itself isn't particularly complicated. The difficult part is getting reliable railway data into a consistent format.

The project currently combines data from sources such as GTFS feeds and open railway datasets. Different operators provide different levels of information, and night trains are especially tricky because a single service can cross several countries and sometimes split or join other services.

I'm gradually working on making the data easier to maintain and expanding the coverage.

Tech stack

The project is built with:

React
Next.js
TypeScript
Leaflet
GTFS data

It's currently deployed on Vercel.

I'm also experimenting with different ways of presenting the data, including ideas like "Where can I go tonight?", where the starting point is all you know.

Why I'm sharing it here

This started as a side project, but it has turned into an interesting combination of frontend development, data processing and railway research.

I'd love to hear from other developers who have worked with GTFS, transit data, maps or OpenStreetMap.

And if you're into trains, I'd especially like to know:

What sleeper train route do you wish existed? πŸš†

The map is here:

https://pingwi.com

Top comments (0)