piemadd / amtrak

NPM library to get Amtrak tracking data.
GNU Affero General Public License v3.0
49 stars 4 forks source link

Question: Fetch trains within X miles of city #3

Open ZoomBug58 opened 2 years ago

ZoomBug58 commented 2 years ago

Hi, is it possible to fetch all trains within a specific miles of a city?

piemadd commented 2 years ago

Currently no, but that shouldn't be too hard to implement. I could jot it down to implement in my rewrite.

piemadd commented 2 years ago

Also in an upcoming update, you'll be able to get the coordinates of each station and use that data to achieve this.

ZoomBug58 commented 2 years ago

Also in an upcoming update, you'll be able to get the coordinates of each station and use that data to achieve this.

Thing is I'm trying to get all trains within x miles of a city, not just the ones stopping at that city/station.

piemadd commented 2 years ago

not just the ones stopping at that city/station.

I am aware. The function returning station information will also have the coordinates of that station, so you could use some math to figure out which trains are in x miles of said station, regardless of if they're stopping there.