Missing instructions in routing and map matching response

Hello there,

we have some trouble getting the response we want using the map-matching api. First of all I like to describe the problem itself:

We are using the map-matching api to snap our coordinates onto the streets and - what is very crucial - to get the street name and street number information. We access the street names and numbers using the instructions given in the gpx response. Here lies the problem. There are only instructions when turns were made. Basically the instruction we get is something like this: “Turn left onto Provinzialstraße, L 157”. But when the street name is changing during the course of the road and no turn is made we do not get any instruction back. However, when the street name is changing we would exspect something like this: “Continue onto L 157”. And this instruction is missing in the response.

What we did so far to tackle the problem:
We used the routing engine and tried to reproduce our problem we are facing with the map-matching api.
We recognized that there is the same problem since the map-matching api makes use of the graphhopper routing engine. So we set up the routing engine and map-matching api locally. In the “InstructionsFromEdges” class of the routing engine we made the following changes:

Original Code:

private int returnForcedInstructionOrIgnore(boolean forceInstruction, int sign) {
    if (forceInstruction)
        return sign;
    return Instruction.IGNORE;

Manipulated Code:

private int returnForcedInstructionOrIgnore(boolean forceInstruction, int sign) {
    if (true || forceInstruction)
        return sign;
    return Instruction.IGNORE;

After rebuilding and running the routing engine as a web application we were able to get a lot more instructions including the before missing instructions when the street name was changing during the course of the street (as it can be seen comparing the attached images). We made then sure that the map-matching api makes use of the changed libraries coming from the local graphhopper routing engine. After rebuilding and starting the map-matching we achieved to get a lot more snapped points than before but we still do not get the instructions (in the gpx response) when the street name is changing during the course as we do using the web application of the manipulated routing engine. So somehow when the instructions do not indicate turns they get discarded and we can´t figure out why and where in the code this happens and how to adjust this.

So the question is: Does anyone know how to solve or tackle this problem? I know it is a special problem but we really need help to make things going so I´m really thankful for every idea or hint.

So thank you in advance!

Best regards


As far as I understand this then the turn instructions are not appropriate for your use case. I suggest using the street_name path details, then you really get only the information you want and also nothing less. Also no code changes are required.

Thank you for your fast reply!
But isn´t it only possible to make use of the path details when using the routing api? Since we like to map-match over 600k gps coordinates at once (using a gpx or json file) I need to use the map matching api. Or is there a possibility to do the map matching only using the routing engine?

It should work for map matching too

Hi karussell,

I just wanted to let you know that it works perfectly fine using json as output type. The strange thing is that I tried to make use of the details a week ago but it didn´t work. The issue was/is that it does not work when you are requesting a gpx response. Switching to json solved the problem for me.
Anyways thank you very much!

1 Like
Powered by Discourse