Snapping GPX on partial network

Hi,

Mapmatching is working great when dealing with a track with all points near the network.
However there are situations where some of the track points are and should stay out of the network. In such case, I would expect the mapmatching output to contain: points snapped on the network, points not aligned with the network.

Is this a target usecase of the map-matching algorithm?
If yes, is it already possible to achieve this with some configuration / code? Or is there some plan / roadmap for such functionnality?

Thanks in advance for your feedback.

Some more details and error messages:

Imagine that someone does a Triatlon and records a GPX of it. He then wants to mapmatch it, but only for the parts that are near to the road network. Not for the part when he was swimming. Similar situations could be cases when a user takes a canoe for a part of his outing, or is crossing a glacier, or more simply just going through a field instead of staying on the road.

At the moment, if we simulate this with a sample GPX walkandboat.gpx (31.1 KB) [1], mapmatching is not supporting such cases.

Either we get an unrealistic deviation [2], or we get an error [3].

Instead of returning an error, to handle such cases, we would need the response to contain the parts that could be snapped, and the parts that could not be snapped.

[1]

[2]
Result with gpx_accuracy=50

[3]
Result with gpx_accuracy=40

message: “Sequence is broken for submitted track at time step 34. observation:Observation{point=47.12943761221159,8.602473365849002,0.0}, 1 candidates: [distance: 470.5736894158046 to 47.127124975482936,8.59726407223785,724.43701171875]. If a match is expected consider increasing max_visited_nodes.”


Hi, @karussell, @easbar, and Michaz (whose discuss nickname I don’t know), you have worked the most on the mapmatching functionnality. Would you have some inputs on this topic?

There are some workarounds that could be implemented in client code like adapatively splitting the GPX in shorter pieces and using straight lines on the portions of route with error / unreasonable length. But I would not go that way if there is interest for a global solution in Graphhopper itself.

Let me know what makes sense / or not for the project and I will see what I can do to help getting there.

I don’t understand these two sentences. But it sounds like you want an option to ignore GPS points that are too far away from the road network?

Hi @easbar, sorry I was not notified of your reply.

But it sounds like you want an option to ignore GPS points that are too far away from the road network?

Yes exactly: some GPS points could be far from the network and that would be correct (swimming, crossing a field, walking on a glacier, …). In that case the result of the mapmatching would contain both points on the network (mapmatched) and points out of the network (which could not be mapmatched).

Do you think it is possible to achieve this in graphhopper?

Yes, pretty sure this is possible, but it would require adjusting the (Java) map matching code for this. I don’t think there is any option that does this out of the box.