Creating Routes that Follow User-Drawn Lines with Map Matching

Hi!

I need to create routes between two points (for example, from a location near the Eiffel Tower garden to exit 3 of the Bir-Hakim metro station in Paris), and I have a specific requirement. I want to allow users to draw a line on the map, and then generate a route that closely follows this line, from the source to the destination.

I’m aware of the ‘areas’ feature in GraphHopper, which allows for the exclusion of certain areas in the route calculation. However, my requirement is the opposite of that. Instead of excluding areas, I want to define a path (a line drawn on the map) that the routing algorithm should adhere to as closely as possible.

  1. Is there an existing feature in GraphHopper that supports this kind of map-matching, where a route is generated to follow a user-drawn line?

  2. If such a feature does not currently exist, could it be feasible to implement this functionality? I’m thinking along the lines of integrating the user-drawn line with the map-matching algorithm to guide the route calculation.

  3. Are there any recommendations or tips on how I might approach this if I need to implement it myself? For example, converting the drawn line into a series of waypoints and using these in the routing query, or any other method.

Any insights, suggestions, or guidance on this would be greatly appreciated.

Thank you!

Yes, and we also call it “map matching” :slight_smile: