GraphHopper


Source link: https://github.com/graphhopper/graphhopper

GraphHopper Routing Engine

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

Community

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

Get Started

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

Questions

All questions can go to our forum where we also have subsections specicially for developers, mobiles 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 and see how to contribute in the next section.

Contribute

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

For the Web

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 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!

For Mobile Apps

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

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 without this CH preparation we call it flexible mode.

The speed mode comes with very fast and lightweight (less RAM) responses and that 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 intense preparation. And implementing certain features are not possible or very complex compared to the flexible mode.

The hybrid mode also requires preparation time and memory, but 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 to 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 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 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.

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.

Docker

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

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/xml 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
  • Multiple weightings (fastest/shortest/...) and pre-built routing profiles: car, bike, racingbike, mountain bike, foot, motorcycle, ...
  • Offers turn instructions in more than 35 languages, contribute or improve here
  • Displays and takes into account elevation data (per default disabled)
  • Can apply real time changes to edge weights (flexible and hybrid mode only)
  • Customize vehicle profiles per request (flexible and hybrid mode only)
  • Possibility to specify a heading parameter of the vehicle for start, end and via points for navigation applications via pass_through or heading parameters (flexible and hybrid mode only)
  • Alternative routes (flexible and hybrid mode only)
  • Turn costs and restrictions (flexible and hybrid mode only)
  • Country specific routing via SpatialRules
  • Multiple profiles and weightings
  • Several pre-built routing profiles: car, bike, racingbike, mountain bike, foot, motorcycle, ...
  • The core uses only a few dependencies (hppc, jts and slf4j)
  • Scales from small indoor-sized to world-wide-sized graphs
  • Find nearest point on street e.g. to get elevation or 'snapp to road'
  • Do map matching with GraphHopper

Resources

Pinterest like awesome menu control for Android.

Lightweight image loader based on Retrofit and RxJava.

An Android Mandrill API Connector.

Android quantity view with add and remove button to simply use as a complex widget with handful of quick customizations.

Gitter.im Java SDK that facilitates communication with Gitter API.

AutoBundle generates boilerplate code for field binding with android.os.Bundle.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes