Graphhopper java library to travel time calculation

Hi, I want to use graph hopper java library.
Just want to know how:

  1. Does graph hopper java library calculates travel time(given it is not updated with traffic etc.)…how correct these times are
  2. How can I extend graph hopper core library to use my implementation for returning times
  3. Instead of extending, can I tell graph hopper java lib to say, for this edge, use this transit time at this time of day
    Basically, updating time estimation for all the edges in the graph by time of day

The Directions API is only usable over internet. For offline usage you can try our open source Java library and ask questions here.

Okay, modified the question category to “Core”

1 Like

@karussell, probably I didn’t put the question correctly.
I am using the graph hopper java library only.
My question is for java library. I have updated the question. Please check.

anybody has the answer?

Yes it does. Just run the demo locally and try if you think the times are correct for your area. The directions API has improved ETAs, meaning they are already quite close to the time it would actually take you for the route.

Both possible. Have a look at the Weighting class. You can create your own Weighting, and implement your own calcMillis method.

Best,
Robin

How can graphhopper give me precise route travel time given…

  1. In Code, I see that it uses default speed(based on road type: highway, street etc.)
  2. The routes are based on OpenStreetMaps, it doesn’t take into account current or historic traffic in any way.
  3. Why you recommend me using weighting, I though it would be more around following:
    https://www.graphhopper.com/blog/2015/04/08/visualize-and-handle-traffic-information-with-graphhopper-in-real-time-for-cologne-germany-koln/
    OR
    Insert traffic data into graphhopper

Because you asked: “How can I extend graph hopper core library to use my implementation for returning times”. Changing the weighting is one answer.

You can also change the speed of edges, which will lead to a different time calculation in the Weighting.

The OpenSource version of GraphHopper does not include live traffic data or a plug&play interface to enable this. Also see this question (which was also posted by you).

1 Like

If I use custom data sources for live traffic and/or history based traffic estimates and use them with graph hopper as mentioned in this blog , how do I take care of:

  1. storing mapping of edge to custom speed (e.g. storing edge id to custom speed)
  2. taking care of OSM Data upgrades, because edge id’s etc. could change since edges can be added/deleted or splitted in new OSM data
  3. How can I take care of saying that speed is not low for the whole section but only for a small portion of the section

Hi,

As mentioned before, there is no ready made solution. You could have a look at this repo, create your own speed value in the FlagEncoder, use the existing speed values, or create a custom weighting.

Best,
Robin