Skip to content
Open source routing engine for OpenStreetMap. Use it as Java library or server.
Java JavaScript Other
Branch: master
Clone or download

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github Setup package deployment for every commit on GitHub packages (#2049) May 28, 2020
android move to 2.0-SNAPSHOT May 22, 2020
api move to 2.0-SNAPSHOT May 22, 2020
benchmark Remove min_one_way_network parameter, clean up subnetwork removal (#2042 May 18, 2020
client-hc move to 2.0-SNAPSHOT May 22, 2020
core Extract HeadingResolver and clean up heading stuff in QueryGraph May 29, 2020
docs from master README.md link to stable tag that we can change in the fu… May 22, 2020
isochrone move to 2.0-SNAPSHOT May 22, 2020
reader-gtfs gtfs ui: use latest logo May 24, 2020
reader-osm Extract GraphHopperRouter from GraphHopper (#1901) May 28, 2020
tools Fix CH for MiniGraphUI May 29, 2020
web-api move to 2.0-SNAPSHOT May 22, 2020
web-bundle Extract GraphHopperRouter from GraphHopper (#1901) May 28, 2020
web Add profiles to skip tools and shaded web jars (#2048) May 28, 2020
.dockerignore Add Dockerfile (#849) Oct 28, 2016
.gitattributes improve lf for windows #1250 Apr 20, 2018
.gitignore gh maps: rename profile_name to name in profiles entry of /info endpoint May 24, 2020
.gitlab-ci.yml Setup periodic benchmarks Dec 28, 2019
.jitpack.yml Add .jitpack.yml because Jitpack is confused by our pom and tries to … Dec 28, 2016
.travis.yml minor cleanup after #2041 May 28, 2020
CONTRIBUTING.md improved CONTRIBUTING.md and added missing contributors to list Sep 20, 2019
CONTRIBUTORS.md GraphHopperServerConfiguration auto-detects available ports (#1928) Mar 13, 2020
Dockerfile Dockerfile: clean up May 27, 2020
LICENSE.txt copy latest graphhopper jar to libs/ Apr 29, 2013
NOTICE.md Mapzen (skadi) elevation provider (#1929) Mar 17, 2020
README.md readme: make contributing a bit more prominent May 22, 2020
appveyor.yml Improve docker image size (#1990) Apr 17, 2020
config-example.yml revert 01a0cbe May 27, 2020
graphhopper.sh include npm as part of the maven cycle (#2041) May 19, 2020
pom.xml Setup package deployment for every commit on GitHub packages (#2049) May 28, 2020

README.md

GraphHopper Routing Engine

Build Status

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.

Community

We have a prospering 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 (iOS&Android), and our map matching component. Another place to ask questions is on Stackoverflow. Do not use our issue section for questions.

Contribute

Read through how to contribute for information on topics like finding and fixing bugs and improving our documentation or translations!

Get Started

To get started, read through our documentation and install the GraphHopper Web Service locally.

Java API Changes

See our changelog file.

Docker

Run a dockerized GraphHopper from sources:

docker build -t graphhopper:master .
docker run -d --name graphhopper -v <path_data_directory>/data:/data -p 8989:8989 graphhopper:master

See also the builds at Docker Hub

DEB or RPM package

There is an experimental step by step guide that creates a debian or rpm package from the cloned and compiled repository. Before we can recommend this we need some more testers and feedback :)

For the Web

See the road routing feature of GraphHopper in action on GraphHopper Maps and install it on your own machine:

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!

For Public Transit

Get started

Realtime Demo

For Mobile Apps

Offline

There are subprojects to make GraphHopper working offline on Android and iOS

simple routing

Online

There is an extension that creates a navigation endpoint to feed a lightweight navigation Android client.

android navigation demo app

For Analysis

There is the isochrone subproject to calculate and visualize the reachable area for a certain travel mode

Isochrone Web API

Isochrone API image

Shortest Path Tree API

high precision reachability image

To support these high precision reachability approaches there is the /spt endpoint (shortest path tree). See #1577

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, 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.

Then there is the hybrid mode which 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.

License

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 Support

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.

Written in Java

GraphHopper is written in Java and runs on Linux, Mac OS X, Windows, BSD, Solaris, Raspberry Pi, Android, Blackberry, and even iOS.

Maven

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>

Customizable

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.

Android / Blackberry

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.

Web UI and API

With the web module, we provide code to query GraphHopper over HTTP and decrease bandwidth usage as much as possible. For that we use an efficient polyline encoding, the Ramer–Douglas–Peucker algorithm, and a simple GZIP servlet filter.

On the client side, we provide a Java and JavaScript client.

Desktop

GraphHopper also runs on the Desktop in a Java application without internet access. For debugging purposes GraphHopper can produce vector tiles, i.e. a visualization of the road network in the browser (see #1572). Also a more low level Swing-based UI is provided via MiniGraphUI in the tools module, see some visualizations done with it here. A fast and production ready map visualization for the Desktop can be implemented via mapsforge or mapsforge vtm.

Features

Here is a list of the more detailed features:

  • Based on Java and simple start for developers via Maven.
  • Works out of the box with OpenStreetMap (osm/xml and pbf) and can be adapted to custom data
  • OpenStreetMap integration: stores and considers road type, speed limit, the surface, barriers, access restrictions, ferries, conditional access restrictions, ...
  • GraphHopper is fast. And with the so called "Contraction Hierarchies" it can be even faster (enabled by default).
  • Memory efficient data structures, algorithms and the low and high level API is tuned towards ease of use and efficiency
  • Provides a simple web API including JavaScript and Java clients
  • Multiple weightings (fastest/shortest/custom/...) and pre-built routing profiles: car, bike, racing bike, mountain bike, foot, hike, motorcycle, wheelchair, ...
  • Customization of these profiles are possible to get truck and cargo bike support or individual improvements
  • Supports public transit routing and GTFS.
  • Offers turn instructions in more than 42 languages, contribute or improve here
  • Displays and takes into account elevation data
  • Can apply real time changes to edge weights (flexible and hybrid mode only)
  • Alternative routes
  • Turn costs and restrictions
  • Country specific routing via SpatialRules
  • The core uses only a few dependencies (hppc, jts and slf4j)
  • Scales from small indoor-sized to world-wide-sized graphs
  • Finds nearest point on street e.g. to get elevation or 'snap to road' or being used as spatial index (see #1485)
  • Does map matching
  • Calculates isochrones and shortest path trees
  • Shows the whole road network in the browser for debugging purposes ("vector tile support") #1572
  • Shows details along a route like road_class or max_speed ("path details") #1142 or for the whole road network via vector tiles
You can’t perform that action at this time.