FlockHopper uses GraphHopper for route calculation. This guide explains how to set up the local routing server.
- Java 11 or higher
- At least 32GB RAM (28GB allocated to GraphHopper for US data)
- ~15GB free disk space for OSM data and graph cache
-
Download GraphHopper
Download the GraphHopper Web JAR (version 9.1 or 10.0):
wget https://repo1.maven.org/maven2/com/graphhopper/graphhopper-web/9.1/graphhopper-web-9.1.jar
-
Download OpenStreetMap Data
For full US coverage (~11.6GB):
wget https://download.geofabrik.de/north-america/us-latest.osm.pbf
For testing with a smaller dataset (Ohio only, ~300MB):
wget https://download.geofabrik.de/north-america/us/ohio-latest.osm.pbf
Update
config.ymlif using a different OSM file:graphhopper: datareader.file: ohio-latest.osm.pbf
-
Start the Server
./start.sh
Or manually:
java -Xmx28g -jar graphhopper-web-9.1.jar server config.yml
-
Verify Installation
The API should be available at http://localhost:8989
Test with:
curl "http://localhost:8989/route?point=40.7128,-74.0060&point=40.7580,-73.9855&profile=car"
The config.yml file contains all GraphHopper settings:
| Setting | Description |
|---|---|
datareader.file |
Path to OSM data file |
graph.location |
Directory for graph cache (generated on first run) |
profiles |
Routing profiles (car, bike, foot) |
server.port |
API port (default: 8989) |
| Dataset | OSM File Size | RAM Required | Graph Build Time |
|---|---|---|---|
| Ohio | ~300MB | 4GB | ~5 minutes |
| Full US | ~11.6GB | 28GB | ~2-3 hours |
On first startup, GraphHopper will:
- Parse the OSM file
- Build a routing graph
- Save the graph to
graph-cache/
This process takes significant time for large datasets. Subsequent startups will be much faster as the cached graph is loaded.
Out of Memory Error
- Increase the
-Xmxvalue instart.sh - Use a smaller regional OSM file for testing
Port Already in Use
- Change the port in
config.ymlunderserver.application_connectors
Slow Route Calculations
- The current config disables CH/LM preprocessing to allow custom models per-request
- This is required for FlockHopper's camera avoidance features
If you can't run GraphHopper locally, set the VITE_GRAPHHOPPER_ENDPOINT environment variable to point to a remote instance.