jagodki / Offline-MapMatching

a QGIS-plugin for matching a trajectory with a network using a Hidden Markov Model and Viterbi algorithm

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Matched trajectory jumps between network edges

anitagraser opened this issue · comments

I've created a very small test dataset with a metric CRS. The match results show some jumping between edges as well as back-tracking on one edge. Is this expected behavior?

selection_324

Jumping between edges is not the expected result. The screenshot of issue #6 shows the problem:
the vertices of the matched edge vom vertex 2 to 3 of the trajectory are not in the right order. The last vertex of this edge should be the second of the three vertices. Same for the matched edge from 5 to 6. Their should be a relation to issue #6. I start to work on this bug.

When I reproduced this bug, it was related to the bug of issue #6. The vertices of the resulting lines were in the wrong direction. Please download the new version of the plugin and let me know, if the problem still exists using your data.

The results are much better now. There is still one issue at position number 7. I've tried different standard deviation settings but the result always includes a section of the wrong edge:
image

This is a difficult situation for the algorithm. A problem could be, that I compare the distance between to following points of the trajectory with the distance between two corresponding candidates, i.e. distance between 6 and 7 with the distance between A and B resp. A and C. Because 7 is behind the crossing, the distance between A and C is very close to the distance between 6 and 7.

I will reproduce such a situation and try to solve it during the next days.
46367070-001e5680-c67d-11e8-9b83-d4f39b1b56fc

Sorry for my late response. I figured out the problem:
the algorithm thinks, that the distance between B and 7 is shorter than between C and 7. Also the distance between A and C is closer to the distance between 6 and 7 than the distance between A and B it is. Same situation in the next transition, calculations with the candidate C produce higher probabilities.

I edited the calculations for the transition probability to avoid such cases:

  1. The direction probability (part of the transition probability) will now be calculated using the slope of each edge between two candidates, not just the slope of the direct curve between the candidates. I.e. for each edge, the slope will be calculated and compared to the slope of the curve from observation 1 to observation 2. The results will be multiplied.
  2. The routing probability will now be calculated using an exponential probability distribution.

The plugin now needs a new parameter to calculate the new routing probability. I hard coded it for my test session and to edit the GUI etc. later. Therefore, the new version (1.1.3) is just an experimental version, but you can download and test it. I now start the work on the GUI and the implementation into the processing framework, which will be published as a new major release.

The screenshots below shows a similar situation than yours. I used a standard deviation of 50 to avoid the u-turn at trajectory point 8.

bildschirmfoto 2018-10-09 um 21 05 37
bildschirmfoto 2018-10-09 um 21 05 45

fixed with the new version 2.0.0