an iOS shortcut for displaying nearest public transport stop's departures
This repository contains source code and auxiliary files for deploying Docker container - back-end and download link for iCloud shortcut - front-end.
Tip
If the user does not want to deploy their own Docker container, they can use author's one. It can be found on following link:
http://gtfs.vojtechlukas.cz/departures
This endpoint is set as default in the iOS shortcut.
Warning
Author's endpoint is provided AS IS with no warranty. Data it returns are based on public source (data.brno).
- Download Shortcut from Releases or directly from this link
- Allow access to current location
- Run the shortcut from your Apple device (iPhone/Watch/Macbook...)
- After fetching data from server, the shortcut will display earliest public transport departures from your nearest stop based on your current location
At this stage of the project, API endpoint [GET] /departures
implemented in app.py can be queried with following arguments:
Argument | Type | Mandatory? | Description |
---|---|---|---|
city |
str | yes | City whose GTFS data shall be examined. So far, just brno is implemented |
lat |
float | yes | Latitude GPS coordinate of current user position |
lon |
float | yes | Longitude GPS coordinate of current user position |
time |
str(HH:MM:SS ) |
no | Time for querying public transport departures. Omitted = current time |
date |
str(YYYY-MM-DD ) |
no | Date for querying public transport departures. Omitted = current date |
domain.com/departures?city=brno&lat=49.123&lon=16.456
- returns JSON with earliest departures from nearest (based on
lat
andlon
fields) public transport stop
domain.com/departures?city=brno&lat=49.123&lon=16.456&date=2024-12-31&time=12:35:00
- returns JSON with departures on Dec 31 2024 at nearest (based on
lat
andlon
fields) public transport stop
Following request
http://domain.com/departures?
lat=49.21630&
lon=16.57843&
city=brno&
time=1:00:00&
date=2024-12-15
returns JSON with following structure and values:
{
"departures": [
{
"departure_time": "01:12:00",
"route_short_name": "N89",
"trip_headsign": "U Luhu",
"trip_id": 56550
},
{
"departure_time": "02:12:00",
"route_short_name": "N89",
"trip_headsign": "U Luhu",
"trip_id": 56557
},
{
"departure_time": "03:12:00",
"route_short_name": "N89",
"trip_headsign": "U Luhu",
"trip_id": 56563
},
// ...
],
"nearest_stop": "Makovského náměstí"
}
- Other Czech cities
- Back-end implementation is ready for additional cities, problem relies in obtaining GTFS data. In Czechia, only City of Brno provides pure GTFS data to public. Other cities' GTFS data are a bit harder to obtain, as CHAPS insists on using obsolete technology (see this thread).
- Solution however might be to indeed use
ftp://ftp.cisjr.cz
and convert JDF data to GTFS using jdf2gtfs script by @masopust
- Android shortcut?
- As author does not posses any Android device, he will not be developing any Android front-end client soon. However, it should be very simple (as iOS shortcut is). If any Android user implements this in shareable form, please let the author know via GitHub issues.
- Other features
- If you have any suggestion, please add a feature request via GitHub issues.