Matched trajectory jumps between network edges
anitagraser opened this issue · comments
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.
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.
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:
- 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.
- 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.
fixed with the new version 2.0.0