FMI Maps, a University of Stuttgart course project, leverages Javalin, a Java web framework, to serve both the frontend and API endpoints. A custom Dijkstra algorithm implementation handles route calculation, with data provided by the University of Stuttgart's Institute for Formal Methods in Computer Science. The graph for the Germany road network contains around 25 million nodes and 50 million edges. Routes are visualized using GeoJSON and the Leaflet JavaScript library.
-
Nearest Node Search
- Select a start and end point on the map by clicking on it.
- You may also enter the coordinates manually or search for a place name or address.
- For the selection of the start point, you can also use your current location.
- We will always find the nearest node to your selection.
-
Route Calculation
- After start and end point are selected, you can calculate the route.
- The route will be calculated using a custom Dijkstra algorithm implementation.
- Depending on the distance, the calculation may take a few seconds.
- On an M1 Pro MacBook Pro, the one-to-all Dijkstra takes 8696ms to calculate.
-
Route Visualization
- After the route is calculated, it will be displayed on the map as a blue line using GeoJSON.
- In the upper right corner of the map, you can open the DevView to get more information about the route, like startNodeID, endNodeID, distance and calculation time.
- If an error occurs during the calculation or the nearest node search, you will get an error message displayed on the map.
-
One-to-All Dijkstra
- You can also calculate the shortest path from a single node to all other nodes.
- This however cannot be done using the frontend. You must use the code interface provided by the
Dijkstra
class. - Please use the Method
shortestPath(int start, int end)
with the arguments<YOUR_START_NODE_ID>
and-1
within theDijkstra
class. The-1
will make sure that the algorithm will calculate the shortest path to all other nodes without stopping early. - Now you can use the
getAllRouteTo(int EndNode)
method to get the shortest path from the start node to any point you desire with the distances and predecessors you just calculated.
-
Dark Mode
- Most importantly, we added a hacky looking dark mode to the website.
- You can toggle the dark mode by clicking on the moon icon in the upper right corner.
- The map is still loading the tiles normally from OpenStreetMap. However we are using a custom stylesheet to edit the colors using a filter which is layered on top of the map.
To execute the project as required by the course, you need to do the following:
- Install Java with Maven.
- Clone the repository.
- Download the graph data (germany.fmi.bz2) from the FMI and the benchmark data from here.
- Place the extracted files (germany.fmi, germany.que and germany.sol) in the root directory of the project.
- Increase the JVM heap size to 6GB. (On Linux and MacOS, you may use
export MAVEN_OPTS="-Xmx6g"
, on Windows, you may useset MAVEN_OPTS="-Xmx6g"
.) - cd into the project directory.
- Run
mvn compile
. - Run the benchmark with
mvn exec:java -Dexec.mainClass="com.gruettecloud.www.Benchmark" -Dexec.args="-graph germany.fmi -lon 9.098 -lat 48.746 -que germany.que -s 638394"
. - If you'd like to use the GUI, run
mvn exec:java -Dexec.mainClass="com.gruettecloud.www.App"
. The web app will be available at http://localhost:7070/.