MCPcopy Index your code
hub / github.com/graphhopper/graphhopper

github.com/graphhopper/graphhopper @11.0

repository ↗ · DeepWiki ↗ · release 11.0 ↗ · + Follow
9,768 symbols 50,899 edges 955 files 1,498 documented · 15% updated 1d ago11.0 · 2025-10-14★ 6,549193 open issues
README

GraphHopper Routing Engine

Build Status

GraphHopper is a fast and memory-efficient routing engine released under Apache License 2.0. It can be used as a Java library or standalone web server to calculate the distance, time, turn-by-turn instructions and many road attributes for a route between two or more points. Beyond this "A-to-B" routing it supports "snap to road", Isochrone calculation, mobile navigation and more. GraphHopper uses OpenStreetMap and GTFS data by default and it can import other data sources too.

Community

We have an open community and welcome everyone. Let us know your problems, use cases or just say hello. Please see our community guidelines.

Questions

All questions go to our forum where we also have subsections specially for developers, mobile usage, and our map matching component. You can also search Stackoverflow for answers.

Contribute

Read through our contributing guide for information on topics like finding and fixing bugs and improving our documentation or translations! We also have good first issues to get started with contribution.

Get Started

To get started you can try GraphHopper Maps, read through our documentation and install GraphHopper including the Maps UI locally.

See the changelog file for Java API Changes.

Click to see older releases

Installation

To install the GraphHopper Maps UI and the web service locally you need a JVM (>= Java 17) and do:

wget https://repo1.maven.org/maven2/com/graphhopper/graphhopper-web/11.0/graphhopper-web-11.0.jar \
  https://raw.githubusercontent.com/graphhopper/graphhopper/11.x/config-example.yml \
  http://download.geofabrik.de/europe/germany/berlin-latest.osm.pbf
java -D"dw.graphhopper.datareader.file=berlin-latest.osm.pbf" -jar graphhopper*.jar server config-example.yml

After a while you see a log message with 'Server - Started', then go to http://localhost:8989/ and you'll see a map of Berlin. You should be able to right click on the map to create a route.

See the documentation that contains e.g. the elevation guide and the deployment guide.

Docker

The Docker images created by the community from the master branch can be found here (currently daily). See the Dockerfile for more details.

GraphHopper Maps

The GraphHopper routing server uses GraphHopper Maps as web interface, which is also open source.

To see GraphHopper Maps in action go to graphhopper.com/maps/, which is an instance of GraphHopper Maps and available for free, via encrypted connections and from German servers - for a nice and private route planning experience!

GraphHopper Maps

GraphHopper Directions API

The GraphHopper Directions API is our commercial offering that provides multiple APIs based on this open source routing engine: the Routing API, the Matrix API, the Isochrone API and the Map Matching API.

It also provides the Route Optimization API, which is based on our open source jsprit project and uses the fast Matrix API behind the scenes.

The address search is based on the open source photon project, which is supported by GraphHopper GmbH.

Public Transit

Get started

Realtime Demo

Mobile Apps

Online

There is a web service that can be consumed by our navigation Android client.

Offline

Offline routing is no longer officially supported but should still work as Android supports most of Java. See version 1.0 with the Android demo and also see this pull request of the iOS fork including a demo for iOS.

Analysis

Use isochrones to calculate and visualize the reachable area for a certain travel mode.

You can try the debug user interface at http://localhost:8989/maps/isochrone/ to see the /isochrone and /spt endpoint in action.

Isochrone Web API

Isochrone API image

Shortest Path Tree API

high precision reachability image

Map Matching

There is the map matching subproject to snap GPX traces to the road.

map-matching-example

Technical Overview

GraphHopper supports several routing algorithms, such as Dijkstra and A* and its bidirectional variants. Furthermore, it allows you to use Contraction Hierarchies (CH) very easily. We call this speed mode; without this CH preparation, we call it flexible mode.

The speed mode comes with very fast and lightweight (less RAM) responses and it does not use heuristics. However, only predefined vehicle profiles are possible and this additional CH preparation is time and resource consuming.

Then there is the hybrid mode which also requires more time and memory for the preparation, but it is much more flexible regardin

Extension points exported contracts — how you extend this code

DebugAlgo (Interface)
@author Peter Karich [10 implementers]
tools/src/main/java/com/graphhopper/ui/DebugAlgo.java
Graph (Interface)
An interface to represent a (geo) graph - suited for efficient storage as it can be requested via indices called node ID [6 …
core/src/main/java/com/graphhopper/storage/Graph.java
PointAccess (Interface)
@author Peter Karich [6 implementers]
web-api/src/main/java/com/graphhopper/util/PointAccess.java
PtRouter (Interface)
(no doc) [19 implementers]
reader-gtfs/src/main/java/com/graphhopper/gtfs/PtRouter.java
TileOrBuilder (Interface)
(no doc) [3 implementers]
web-bundle/src/main/java/vector_tile/VectorTile.java
Router (Interface)
(no doc)
map-matching/src/main/java/com/graphhopper/matching/MapMatching.java
MapLayer (Interface)
@author Peter Karich [2 implementers]
tools/src/main/java/com/graphhopper/ui/MapLayer.java
Storable (Interface)
Interface for a storage abstraction. Currently is serves just the purpose to ensure the same methods and names through a [12 …
core/src/main/java/com/graphhopper/storage/Storable.java

Core symbols most depended-on inside this repo

get
called by 2184
core/src/main/java/com/graphhopper/coll/LongLongMap.java
set
called by 2079
core/src/main/java/com/graphhopper/util/EdgeIteratorState.java
setDistance
called by 1777
core/src/main/java/com/graphhopper/util/EdgeIteratorState.java
edge
called by 1372
core/src/main/java/com/graphhopper/storage/Graph.java
setTag
called by 1286
core/src/main/java/com/graphhopper/reader/ReaderElement.java
add
called by 1277
core/src/main/java/com/graphhopper/coll/GHBitSet.java
size
called by 874
core/src/main/java/com/graphhopper/util/PathSimplification.java
edge
called by 618
core/src/main/java/com/graphhopper/storage/BaseGraph.java

Shape

Method 8,425
Class 1,111
Interface 109
Function 71
Enum 52

Languages

Java98%
TypeScript2%

Modules by API surface

web-bundle/src/main/java/vector_tile/VectorTile.java413 symbols
core/src/main/java/com/graphhopper/routing/ch/CHPreparationGraph.java146 symbols
core/src/main/java/com/graphhopper/GraphHopper.java107 symbols
core/src/main/java/com/graphhopper/storage/BaseGraph.java97 symbols
core/src/test/java/com/graphhopper/GraphHopperTest.java90 symbols
core/src/test/java/com/graphhopper/routing/RoutingAlgorithmTest.java89 symbols
core/src/test/java/com/graphhopper/routing/ch/EdgeBasedNodeContractorTest.java85 symbols
core/src/test/java/com/graphhopper/routing/ch/CHTurnCostTest.java61 symbols
core/src/main/java/com/graphhopper/routing/subnetwork/EdgeBasedTarjanSCC.java61 symbols
core/src/test/java/com/graphhopper/routing/PathTest.java57 symbols
core/src/main/java/com/graphhopper/storage/BaseGraphNodesAndEdges.java56 symbols
core/src/main/java/com/graphhopper/routing/Router.java56 symbols

Dependencies from manifests, versioned

ch.qos.logback:logback-classic
com.carrotsearch:hppc0.8.1 · 1×
com.fasterxml.jackson.core:jackson-core
com.fasterxml.jackson.dataformat:jackson-dataformat-xml
com.fasterxml.jackson.jakarta.rs:jackson-jakarta-rs-xml-provider
com.graphhopper.external:jackson-datatype-jts2.19.2 · 1×
com.graphhopper:directions-api-client-hc
com.graphhopper:graphhopper-core
com.graphhopper:graphhopper-map-matching
com.graphhopper:graphhopper-nav

For agents

$ claude mcp add graphhopper \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact