graphhopper | Open source routing engine for OpenStreetMap | Map library

 by   graphhopper Java Version: 7.0 License: Apache-2.0

kandi X-RAY | graphhopper Summary

kandi X-RAY | graphhopper Summary

graphhopper is a Java library typically used in Geo, Map applications. graphhopper has no bugs, it has no vulnerabilities, it has build file available, it has a Permissive License and it has high support. You can download it from GitHub, Maven.

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 regarding changing properties per request or e.g. integrating traffic data. Furthermore, this hybrid mode is slower than the speed mode, but it is an order of magnitude faster than the flexible mode and uses less RAM for one request. If the preparations exist you can switch between all modes at request time.

            kandi-support Support

              graphhopper has a highly active ecosystem.
              It has 4183 star(s) with 1411 fork(s). There are 176 watchers for this library.
              There were 1 major release(s) in the last 12 months.
              There are 199 open issues and 1317 have been closed. On average issues are closed in 1304 days. There are 26 open pull requests and 0 closed requests.
              It has a positive sentiment in the developer community.
              The latest version of graphhopper is 7.0

            kandi-Quality Quality

              graphhopper has 0 bugs and 0 code smells.

            kandi-Security Security

              graphhopper has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              graphhopper code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              graphhopper is licensed under the Apache-2.0 License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              graphhopper releases are available to install and integrate.
              Deployable package is available in Maven.
              Build file is available. You can build the component from source.
              Installation instructions, examples and code snippets are available.
              graphhopper saves you 91266 person hours of effort in developing the same functionality from scratch.
              It has 101810 lines of code, 7649 functions and 966 files.
              It has medium code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed graphhopper and discovered the below as its top functions. This is intended to give you an instant insight into graphhopper implemented functionality, and help decide if they suit your requirements.
            • Returns a GeoJSON representation of a given point
            • Finds all of the points in a given list of locations
            • Wrap a geometry
            • Find a node with a given stop id
            • Handle a GET request
            • Computes an IsolePolygon based on a set of edges
            • Packs a list of rings into holes
            • Gets the main component of the polygon with the specified point
            • Handle GET requests
            • Create EncodedValue from string
            • Create a profile based on the profile information
            • Read a 64 - bit long
            • Extracts the road names of a way
            • Imports a public transit index
            • Of the edge pointer
            • Checks if the edge is different from the last edge
            • Get XY coordinates
            • Create a route path
            • Converts a feed into a trip with stopTimes
            • Create a new edge
            • Route a GHM request
            • Entry point for the graphHopper
            • Writes the specified list of entries to the storage
            • Runs the graphhopper
            • Handles a request to retrieve a geometry
            • Implements the visitor to filter out variables
            Get all kandi verified functions for this library.

            graphhopper Key Features

            No Key Features are available at this moment for graphhopper.

            graphhopper Examples and Code Snippets

            No Code Snippets are available at this moment for graphhopper.

            Community Discussions


            how to add leaflet routing machine control to another div instead of map: react-leaflet
            Asked 2022-Mar-10 at 09:30

            I want to display routing machine control div on dashboard (collapse side bar like google maps) instead of map div, because it is covering the map on mobile version. is there any easier way to do that? I have tried this 2 ways : appending control div to another div , appending control div with onAdd(map)

            I have 3 components MapComponent, RoutingMachine and Dashboard.




            Answered 2022-Mar-10 at 09:30

            You can achieve that behavior using two refs. One will be the div to attach the control and the other other one the ref of the routing machine instance.



            How do I apply the Graphhopper library for coordinates with given latitude/longitude?
            Asked 2022-Jan-31 at 16:08

            I want to calculate the shortest route from one to many places with coordinates (latitude, longitude).

            The question is now how to apply the Graphhopper library for coordinates with given latitude/longitude.

            For example with the coordinates of some given cities (start place is Berlin), Berlin, Hamburg, Bielefeld, Dortmund, Essen, Bonn, Frankfurt, Trier and Paderborn, one route is: Berlin -> Hamburg -> Bielefeld -> Paderborn -> Dortmund -> Essen -> Bonn -> Trier -> Frankfurt



            Answered 2022-Jan-26 at 07:34

            The following link provides the implementation of the travelling salesman problem:

            I used the solution to get the route:



            How convert type Point from MySQL with JdbcTemplate?
            Asked 2021-Dec-07 at 02:46

            Need Help! I am unable to convert a Point from MySQL using JdbcTemplate. However, when using JPA it worked out!

            Don't suggest an answer with SELECT ST_AsWKT() + WKTReader(), I have already tried and it did not work out very well...

            Maybe you need to specify the SpatialDialect for JDBC or write a custom converter???




            Answered 2021-Nov-12 at 15:59

            Assuming you only want to "extract" the Point geometry,
            I think you should check out how Hibernate Spatial does the extraction of JTS Geometry from JDBC ResultSet - your starting point should be

            (if you also want to "store" the geometry, I don't have any tip right now for you)

            The code (adapted from said class) could look something like this:



            leaflet routing machine - IRoute.summary.totalDistance
            Asked 2021-Dec-03 at 15:49

            I am using Leaflet 1.2.0 and Leaflet Routing Machine 3.2.12.

            My code is drawing the correct route on the map, yet, when i want to access the summary and the totalDistance from the summary, both are undefined. Why is that?



            Answered 2021-Dec-03 at 15:49

            this doesn't have a summary. You will need to refer to e.routes, like e.routes[0].summary.totalDistance.



            AnyLogic bug pedestrians flying across the GIS map mid-journey
            Asked 2021-Oct-06 at 13:42

            Final edit- This turned out to be a bug with routing regression in AnyLogic and is getting fixed in the next update.

            I'm developing a town simulation with pedestrian agents moving around it. The GIS region data I use is loaded from a .osm file in foot-traffic mode, and I randomly spawn building agents around the region.

            They walk around the city fine at first, but around halfway to their destination, they suddenly fly across the town at high speed in a straight line to where they're going. They seem to arrive at the GIS node closest to the building, and then walk the last couple of meters inside. I believe this occurs with every pedestrian I've tried.

            I am using Dijkstra bidirectional path-finding (built-in to AnyLogic). I have tried A* bidirectional with the same results, as well as using a different .osm/.pbf file, and trying it on fast and short route mode with no luck.

            I have a feeling it is a bug in the bidirectional pathfinding, however AnyLogic doesn't allow non-bidirectional routing, or a way of implementing your own for GIS regions...

            Any ideas would be appreciated.


            I came back to this bug and have determined it is 100% a path-finding bug. When creating a GIS route between 2 points using the AnyLogic online server, it works as expected and we can see a completed route. However, when using a loaded offline OSM or PBF file (I tried different map sources), I observe that the route it draws goes correctly halfway but then draws a straight line to the node closest to the destination, then a straight line to the destination. I have attached 2 pictures to demonstrate this.

            Note that it doesn't make it halfway in distance, it is halfway in node count.

            We can see the nodes exist based on the pictures below, but the routing ignores the second half of them. I'm sure it's not a disconnected network, as I tested a lot and sometimes it would route over a section of road fine, but other times it would fail at it.

            So I suppose now my question is: how do I prevent or get around this? I tried using a custom GraphHopper router to get around the bidirectional routing and just use regular A* search, but didn't have any luck as the other algorithms I tried just made straight lines.

            This is what happens when making the first point at the bottom:

            This is what happens when making the first point at the top:

            This is with online routing:



            Answered 2021-Aug-25 at 17:44

            as Benjamin already stated, this probably happens because you have multiple networks and routing acts in unpredictable ways sometimes when you have networks that are not defined as you would like.

            Search on network on the projects section and be sure there is only 1 network..

            For instance in the following image, you see that there are 2 networks... find a way to connect things in order to end up with 1 network...



            Use OpenLayers for Draw Route from GraphHpper
            Asked 2021-Jun-25 at 10:04

            I'm new in use map GraphHopper, OpenStreetMap, and others library. I want to draw route which generated by GraphHopper Routing Engine (actually in Java language). Is that possible for draw route from GH using OpenLayer?
            I have read this GWT-OpenLayer, but I can't find how to write a route in real road like this GraphHopper Routing Example
            I hope openlayers API can cover my need

            1. GH Routing Engine generate route from A (long, lat) to B (long, lat)
            2. OpenLayers GWT draw every route from GH

            Any help will appreciate :)



            Answered 2021-Jun-25 at 10:04

            The GraphHopper routing API is very similar to many other routing APIs, it can be fetched directly from a JavaScript application such as OpenLayers and the result contains a polyline as used in this example (but the polyline can contain elevations and has a standard ie5 scale factor). Changing the OpenLayers example to use the route in your GraphHopper example (I copied the API key but for production you should get your own) the result is:



            How can I start a java application with parameters using a pm2 config file?
            Asked 2020-Dec-04 at 00:15

            I'm trying to start graphhopper using pm2... graphhopper is a java application and the way I initiate it on the terminal is by going to its folder and entering the following command:



            Answered 2020-Jul-29 at 01:11

            As stated in the comments, this issue can be solved by creating a bash script and running it with pm2 instead of running directly the java application... The bash script used was the file as the following:



            Graphhopper - how to set the routing profile 'foot'
            Asked 2020-Apr-16 at 05:34

            How can I set the route profile 'foot'? Using the default profile 'car' I can't calculate the distance between any location (in the woods) and a nearby footpath.

            The error message I get is:



            Answered 2020-Apr-16 at 05:34

            The issue was that the Graph (i.e. the graphhopper generated routing files) were not aligned with the config settings in the app.

            In the answer below I wanted to have a routing facility for both foot, bike and car. It is of course possible to get only routing for only 1 type of 'vehicle'. I tested this also for the routing profile 'foot'.

            To get this alignment, I first edited the config.yml file in a clone of the graphhopper project. In the config file I changed:



            Gradle sync failed in android studio 3.6
            Asked 2020-Apr-13 at 05:23

            Gradle sync failed: Don't know how to build models for org.gradle.tooling.internal.gradle.DefaultGradleBuild@61cdce4



            Answered 2020-Apr-13 at 05:23

            Your build.gradle (Module:app) should look like this


            Community Discussions, Code Snippets contain sources that include Stack Exchange Network


            No vulnerabilities reported

            Install graphhopper

            To get started you can try GraphHopper Maps, read through our documentation and install the GraphHopper Web Service locally.
            4.x: documentation, web service jar, announcement
            unstable master: documentation
            To install the GraphHopper Maps UI and the web service locally you need a JVM (>= Java 8) and do:. 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.


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

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries

            Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link