GraphHopper is a fast and memory efficient Java routing engine, released under Apache License 2.0. By default it uses OpenStreetMap and GTFS data, but it can import other data sources.
We have a prospering community and welcome everyone. Let us know your problems, use cases or just say hello. Please see our community guidelines.
To get started, read through our documentation and install the GraphHopper Web Service locally:
All questions can go to our forum where we also have subsections specially for developers, mobile usage (iOS&Android), and our map matching component. Another place to ask questions would be on Stackoverflow, but please do not use our issue section. Create new issues only if you are sure that this is a bug. Also, see how to contribute in the next section.
Read through how to contribute for information on topics like finding and fixing bugs and improving our documentation or translations!
See GraphHopper in action on GraphHopper Maps
GraphHopper Maps uses the Directions API for Business under the hood, which provides a Routing API via GraphHopper, a Route Optimization API via jsprit, a fast Matrix API and an address search via Photon. Additionally, map tiles from various providers are used where the default is Omniscale. All of these are available for free, via encrypted connections and from German servers for a nice and private route planning experience!
There are subprojects to make GraphHopper working offline on Android and iOS
There is the isochrone subproject to calculate and visualize the reachable area for a certain travel mode
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, although it does not use heuristics in its default settings. The downsides are that the speed mode allows only pre-defined vehicle profiles (multiple possible in GraphHopper) and requires a time consuming and resource-intensive preparation. Finally, implementing certain features is not possible or very complex compared to the flexible mode.
The hybrid mode also requires preparation time and memory, but it is much more flexible regarding changing properties per request or e.g. integrating traffic data and more. Furthermore, this hybrid mode is slower than the speed mode, but it is an order of magnitude faster than the flexible mode and uses also less RAM for one request.
You can switch between all modes at request time.
We chose the Apache License to make it easy for you to embed GraphHopper in your products, even closed source. We suggest that you contribute back your changes, as GraphHopper evolves fast, but of course this is not necessary.
OpenStreetMap is directly supported from GraphHopper. Without the amazing data from OpenStreetMap, GraphHopper wouldn't be possible at all. Other map data will need a custom import procedure, see e.g. Ordnance Survey, Shapefile like ESRI or Navteq.
GraphHopper is written in Java and runs on Linux, Mac OS X, Windows, BSD, Solaris, Raspberry Pi, Android, Blackberry, and even iOS.
Embed GraphHopper with OpenStreetMap support into your Java application via the following snippet:
<dependency>
<groupId>com.graphhopper</groupId>
<artifactId>graphhopper-reader-osm</artifactId>
<version>[LATEST-VERSION]</version>
</dependency>
If you want to write your own import procedure or you don't need OSM import like on Android, then use:
<dependency>
<groupId>com.graphhopper</groupId>
<artifactId>graphhopper-core</artifactId>
<version>[LATEST-VERSION]</version>
</dependency>
We've built the GraphHopper class which makes simple things easy and complex things like multi-modal routing possible. Still, you can use the low level API of GraphHopper and you'll see that it was created to allow fast and memory efficient use of the underlying data structures and algorithms.
On Android and Blackberry (since 10.2.1), we provide an integration with Mapsforge which makes offline navigation one step closer. Due to the usage of memory mapped files and Contraction Hierarchies, we avoid allocating too much memory. This makes it possible to run Germany-wide queries with only 32MB in a few seconds. We provide an Android studio project as well as the Maven-Android integration to be used in other IDEs.
With the web module, we provide code to query GraphHopper over HTTP and decrease bandwidth usage as much as possible.
For that we use a polyline encoding from Google, the Ramer–Douglas–Peucker algorithm, and a simple
GZIP servlet filter.
On the client side, we provide Java and JavaScript code (via Leaflet) to consume that service and
visualize the routes.
GraphHopper also runs on the Desktop in a Java application without internet access. E.g. you could use the rough user interface called MiniGraphUI provided in the tools module, see some visualizations done with it here. A fast and production ready map visualization for the Desktop can be easily implemented via mapsforge.
Install GraphHopper via Docker. You only need to change the docker-compose.yml entrypoint in core/files/ to run whatever map you like. Then just type:
cd core/files/
docker-compose up -d
If you don't want to use docker-compose you can do the following:
docker build -t graphhopper:master .
docker run -d --name graphhopper -v <path_data_directory>/data:/data -p 8989:8989 graphhopper:master
Here is a list of the more detailed features including a link to the documentation:
pass_through
or heading
parameters (flexible and hybrid mode only)此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。