juliuste / direkt.bahn.guru

All direct long-distance railway connections for cities in and beyond central Europe.
https://direkt.bahn.guru
GNU General Public License v3.0
373 stars 24 forks source link

[Suggestion] Possibility to enter two (or more) stations / find out fastest half-way meeting spot #9

Open mandrasch opened 3 years ago

mandrasch commented 3 years ago

Hey,

amazing online tool, thanks for providing it! :+1:

I just had a quick idea for displaying / comparing the results of two (or more) locations to get the fastest half-way meeting spot for friends in different cities. Guess the idea is obvious, but I wanted to open it up here anyway (for anyone interested).

Took a first look in the source code. Got it running using my own mapbox.com-API key. Just wondered how do you develop locally? Found no npm run start, I ran npm run build after changes and served the index.html via http-server ..

In a first quick try I managed to persist locations by declaring const geojson ... globally and using geojson.features.push(...features) instead of geojson.features = features.

image Example Edinburgh (Scotland) and Gmunden - no overlap

But of course the fetch request must be extended to compare the results as far as I understand it (https://github.com/juliuste/direkt.bahn.guru/blob/main/src/index.js#L173).

If I find time to dive into this, I'll update this issue of course.

If this is not within your scope, sorry for the interruption. :)

Best regards, Matthias

katrinleinweber commented 2 years ago

I've prototyped a script to do this in the shell Ruby.

+1 for an official, 2nd search bar (and then only displaying the intersect). That would be so useful for planning trips together :-)

katrinleinweber commented 2 years ago

I've improved the prototype ☝️ with better explanations & output formatting. Maybe it should be a Ruby gem?

romanboehm commented 1 year ago

I also found that functionality useful. Since I wanted to have it right away and since I'm not very JavaScript-literate, I put together a plain Java script (heh): https://github.com/romanboehm/destinations

This can handle an arbitrary number of locations and offers limited parametrization, e.g. max duration.