/graphhopper

Open source routing library and server using OpenStreetMap :earth_africa: #route #planner

Primary LanguageJavaApache License 2.0Apache-2.0

GraphHopper Route Planner

Build Status

GraphHopper is a fast and memory efficient Java road routing engine released under Apache License 2.0. Per default it uses OpenStreetMap data but can import other data sources.

GraphHopper for the Web

See GraphHopper in action on GraphHopper Maps

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 the map tiles from various providers are used where the default is Omniscale, and all is available for free, via encrypted connections and from German servers for a nice and private route planning experience!

GraphHopper for Mobile

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

Get Started

Read through our Documentation (0.6, unstable), ask questions on Stackoverflow and sign up to the discussion.

Contribute

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

Technical Overview

GraphHopper supports several routing algorithms like Dijkstra and A* and its bidirectional variants. Furthermore it allows you to use Contraction Hierarchies (CH) very easily, we call this speed mode and in contrast to the speed mode we call everything without CH the flexibility mode. BTW: This does not mean that the flexibility mode is slow.

The speed mode comes with much faster and lightweight (less RAM) responses and 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 intense preparation. And implementing certain features are not possible or very complex compared to the flexibility mode. Since 0.4 you can use both modes at the same time. See here for more details.

License

We chose the Apache License to make it easy for you to embed GraphHopper in your products. We suggest to contribute back your changes, as GraphHopper will 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. Other environments which supports at least Java 5 will work too.

Customizable

We've build 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 datastructures 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 which 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 the 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.

Desktop

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.

Features

Here is a list of the more detailed features including a link to the documentation:

  • Simple start for users - just Java necessary! Simple start for developers due to Maven.
  • Works out of the box with OpenStreetMap (osm and pbf) but can be adapted to use your own data
  • OpenStreetMap integration: Takes care of the road type, 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
  • Offers turn instructions in more than 30 languages, contribute or improve here
  • Displays and takes into account elevation data (per default disabled)
  • Can apply real time changes to edge weights (flexibility only)
  • Customized routing profiles per request (flexibility only)
  • Possibility to specify a 'heading parameter' for start, end and via points for navigation applications via pass_through or favoredHeading parameters (flexibility only)
  • alternative routes (flexibility only)
  • turn costs and restrictions (flexibility only)
  • multiple profiles and weightings (flexibility and speed mode since 0.5)
  • several pre-built routing profiles: car, bike, racingbike, mountain bike, foot, motorcycle
  • the core uses only a few dependencies (trove4j and slf4j)
  • scales from small indoor- to world-wide-sized graphs
  • map matching component (flexibility only)