Closed bsramo144 closed 1 year ago
This was not readily available. I added some functionality to the master branch that allows for this. For example:
matcher = DistanceMatcher(map_con, max_dist=0.5, obs_noise=1, min_prob_norm=0.5, max_lattice_width=3)
matcher.match(path)
# Matcher ends early with and early_stop_idx that is lower than the path length
matcher.continue_with_distance()
matcher.match(path, expand=True)
You can also pass on the matching objects you prefer yourself by:
from_matches = self.best_last_matches(k=2, nb_obs=2, max_dist=3)
matcher.continue_with_distance(from_matches= from_matches)
Thank you, I tried to follow your first example, but it returns the attribute error: 'DistanceMatcher' object has no attribute 'continue_with_distance'.
I don't understand why it is so.
Did you use the code on the master branch? It is available in all matchers: https://github.com/wannesm/LeuvenMapMatching/blob/ec2f48fa727eb7d707b56a133943456847ca0dd5/leuvenmapmatching/matcher/base.py#L1321
Here is the code I used, the DistanceMatcher itself works, however, the _continue_withdistance returns the error.
matcher = DistanceMatcher(map_con,
max_dist = MAX_DIST,
min_prob_norm = MIN_PROB_NORM,
max_lattice_width = MAX_LATTICE_WIDTH,
increase_max_lattice_width = INCREASE_MAX_LATTICE_WIDTH,
obs_noise = OBS_NOISE,
obs_noise_ne = OBS_NOISE_NE,
non_emitting_edgeid=False,
restrained_ne = False)
matcher.match(path, unique=False)
if matcher.early_stop_idx is not None:
print("The map matching was interrupted. A part of the path did not find a match to the graph.")
matcher.continue_with_distance(k=MAX_LATTICE_WIDTH, max_dist=MAX_DIST)
matcher.match(path, expand=True)
From this example it is not clear how you installed or are using the master branch (instead of the pypi package).
Did you download the repository and run it locally or did you use something like pip install --force-reinstall git+https://github.com/wannesm/LeuvenMapMatching.git
.
Thank you, the package has to be reinstalled... it was running locally. It is working!
Great. I'll close the issue. Since it's still a beta feature, feel free to reopen if you encounter any bugs.
Hello, is it possible to interrupt the matched path and start a new matched path as soon as the algorithm finds a match with the graph again?
So far, the whole matching stops whenever the state cannot find a match. In my case, it is not due to very strict parameters but rather a missing road network. It would be nice if the matching did not stop after the first fail.
Thank you!