A Java public transport routing engine that calculates optimal paths, travel times and distances using OpenStreetMap and GTFS data. It supports multi-modal transport (bus and walking) and displays results on an interactive map.
- JDK 17 or newer
- MySQL server
- JavaFX SDK 21 (the GUI runs with
--module-path <javafx-sdk>/lib --add-modules javafx.controls,javafx.fxml,javafx.web) - The JAR dependencies in
lib/(already included in this repository)
-
Download GTFS Data
- Download the
GTFS.zipfile for the Netherlands. - Create a MySQL database named
bcs7and import the data into it.
- Download the
-
Configure Database Connection
Credentials are read from environment variables, so nothing needs to be edited in the source code.
Variable Required Default DB_USERNAMEno rootDB_PASSWORDyes empty DB_URLno jdbc:mysql://localhost:3306/bcs7?useSSL=false&allowPublicKeyRetrieval=trueSet them in your shell before launching:
export DB_USERNAME=your_mysql_user export DB_PASSWORD=your_mysql_password
On Windows (PowerShell):
$env:DB_USERNAME = "your_mysql_user" $env:DB_PASSWORD = "your_mysql_password"
In IntelliJ IDEA you can also set them under Run > Edit Configurations > Environment variables.
-
Initial Data Cleanup
- On the first launch, call the
cleanDatamethod fromDataGetterin themapGUI.mainmethod:dataGetter.cleanData(); - This process cleans up excess data to improve query performance.
- Important: Running
cleanDatatakes some time, so after you have used it to clear your database, you should remove it from themainmethod for future launches to speed up the startup process.
- On the first launch, call the
-
Launch
- Run the
mainmethod in theGui.mapGUIclass to launch the application.
- Run the
-
Usage
- The application allows you to input two postcodes. It only accepts postcodes within the vicinity of Maastricht.
- If you do not input appropriate postcodes, it will display an error message.
- Note: If the API throws an error, you may wish to look for an alternative API to call from. Try
https://project12.ashish.nl/get_coordinates.
The application should now be ready to use for exploring public transport routes.