You can try this out at https://fbarbe00.github.io/EveryTransitLine/
Have you every wanted to take all the public transport lines in your city? No? That's alright, but this script allows you to do it anyway.
EveryTransitLine is a web-based tool that finds a path to ride every public transit line (e.g. tram, metro, bus, ...) in a city. Using a GTFS feed, it calculates an itinerary that maximizes route coverage, while minimising time.
This website uses pure HTML and Javascript, and runs fully in browser. You can therefore simply open index.html
in your browser, or deploy on a server.
GTFS data can be downloaded on websites such as Mobility Database. I recommend filtering the file beforehand, using gtfsclean:
gtfsclean --date-start "$today" --date-end "$end_date" --delete-orphans --compress -z --zip-compression-level 7 -o "$city_zip" "$input_zip"
When deploying on a server, sample files can be defined in js/config.js
Here is a breakdown of the project files and how you can modify them.
index.html
- What it does: Defines the entire HTML structure and layout of the application.
- How to tweak: Modify this file to change the UI layout, add or remove text, or adjust Tailwind CSS classes.
style.css
- What it does: Contains custom styles for animations, Leaflet map components, and other elements that are difficult to style with utility classes.
- How to tweak: Edit this file to change the appearance of loaders, progress bars, map tooltips, and other custom-styled components.
config.js
- What it does: The main configuration hub. It defines demo GTFS URLs, route type mappings, and default colors.
- How to tweak: This is the config file Add your own demo GTFS datasets to the
DEMO_URLS
object or adjust how route types are categorized.
app.js
- What it does: The main application entry point. It initializes all components and wires up all event listeners (e.g., button clicks, input changes).
- How to tweak: Modify this file to change the overall application flow or how user events are handled.
gtfs_data_handler.js
- What it does: Handles all GTFS data loading, parsing, and processing. It builds the network graph used by the search agents.
- How to tweak: Modify this only if you need to support a non-standard GTFS feature or change how the data is structured in memory.
astar_agent.js
&other_agents.js
- What they do: Implement the core search algorithms (A* Coverage and Beam Search).
- How to tweak: You can change the scoring functions (
f_score
), heuristics, or agent parameters (e.g.,beamWidth
) to alter the balance between search speed and path quality, or implement new agents.
ui_helpers.js
- What it does: Contains functions that manipulate the DOM to display results, such as populating the path instructions list or creating checkboxes.
- How to tweak: Edit this file to change how search results, summary statistics, and path instructions are formatted and displayed to the user.
map_interaction.js
- What it does: Manages all Leaflet map interactions, including initialization, drawing path polylines, and handling map clicks.
- How to tweak: Change the map's appearance (e.g., tile layer), path colors, or popup content.
utils.js
- What it does: A collection of general helper functions for tasks like date/time conversion and distance calculations.
- How to tweak: Add new utility functions or modify existing calculations if needed.
All icons have been taken from pictogrammers.com: https://pictogrammers.com/docs/general/license/.
This project is licensed under the MIT License. See the LICENSE
file for details.