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
Martin