Question about Map Matching and Predicting Road Information

Hi GraphHopper community,

I’m currently working on a project using GraphHopper’s map-matching functionality to predict the road a user is traveling on and display relevant information, such as maximum speed, to the user. I’m looking for assistance on how to identify and predict the connected roads from the user’s current location.

Specifically, I’m interested in:

  1. How to determine the edges connected to the road segment the user is currently on.
  2. Methods or approaches to predict and provide information about these connected road segments in advance to the user.

If anyone has experience or knowledge in achieving these goals with GraphHopper, I would greatly appreciate your insights and guidance.

Thank you in advance for your help!

Once you found the edge the user is currently on you can explore the neighboring edges like this:

EdgeIteratorState current;
GraphHopper hopper;
EncodingManager encodingManager = hopper.getEncodingManager();

// this will depend on the information you are interested in
EnumEncodedValue<RoadClass> roadClassEnc = encodingManager.getEncodedValue(RoadClass.KEY);

EdgeExplorer explorer = hopper.getBaseGraph().createEdgeExplorer();
EdgeIterator iter = explorer.setBaseNode(current.getBaseNode()); // use current.getAdjNode() to explore the edge in the opposite direction
while (iter.next()) {
     RoadClass roadClass = iter.get(roadClassEnc); // this is the road class of the neighboring edge
}
1 Like

I have a question regarding GraphHopper’s map-matching functionality. Does GraphHopper support one-way roads in its map-matching feature?