bmwcarit / barefoot

Java map matching library for integrating the map into software and services with state-of-the-art online and offline map matching that can be used stand-alone and in the cloud.
Apache License 2.0
671 stars 183 forks source link

Points are not matched properly #56

Closed fil1o closed 7 years ago

fil1o commented 7 years ago

Hello. First of all, thanks for this great package. We've had a great time using it.

While looking at our results we found some point that weren't matched properly. Here's a our case. The points are located on a highway in Bulgaria. Original points. https://www.darrinward.com/lat-long/?id=2998629 42.593219,27.387029 42.593238,27.389142 42.593103,27.391241 42.592706,27.3931 42.59213,27.394631 42.59153,27.395677 42.591096,27.396121 42.590597,27.395716 42.590736,27.394959 42.591234,27.39421 42.592027,27.393701 42.592946,27.39331 42.593981,27.392902

Matched points. https://www.darrinward.com/lat-long/?id=2998627 42.593238611937764,27.38702862831659 42.59325732877199,27.38914244441927 42.593094358151596,27.391238352185045 42.59267606365939,27.393082229335054 42.59207070749009,27.3945796320841 42.5921101,27.3936154 42.5921101,27.3936154 42.5921101,27.3936154 42.5921101,27.3936154 42.5921101,27.3936154 42.5921101,27.3936154 42.592946896933576,27.39331462726809 42.593984827814886,27.392920323594343

smattheis commented 7 years ago

It looks like the motorway link is not part of the street map. However, I couldn't see any wrong data on quick scan.

Thanks.

fil1o commented 7 years ago

There are no HMM breaks.

[ {"point ":"POINT (27.369431 42.594829)"," time":"2017-04-25 16:54:45","id":"\x0001"}, {"point ":"POINT (27.371582 42.594401)"," time":"2017-04-25 16:54:50","id":"\x0001"}, {"point ":"POINT (27.373774 42.594035)"," time":"2017-04-25 16:54:55","id":"\x0001"}, {"point ":"POINT (27.375982 42.593736)"," time":"2017-04-25 16:55","id":"\x0001"}, {"point ":"POINT (27.378193 42.593495)"," time":"2017-04-25 16:55:05","id":"\x0001"}, {"point ":"POINT (27.380419 42.593336)"," time":"2017-04-25 16:55:10","id":"\x0001"}, {"point ":"POINT (27.382636 42.593245)"," time":"2017-04-25 16:55:15","id":"\x0001"}, {"point ":"POINT (27.384848 42.593206)"," time":"2017-04-25 16:55:20","id":"\x0001"}, {"point ":"POINT (27.387029 42.593219)"," time":"2017-04-25 16:55:25","id":"\x0001"}, {"point ":"POINT (27.389142 42.593238)"," time":"2017-04-25 16:55:30","id":"\x0001"}, {"point ":"POINT (27.391241 42.593103)"," time":"2017-04-25 16:55:35","id":"\x0001"}, {"point ":"POINT (27.3931 42.592706)"," time":"2017-04-25 16:55:40","id":"\x0001"}, {"point ":"POINT (27.394631 42.59213)"," time":"2017-04-25 16:55:45","id":"\x0001"}, {"point ":"POINT (27.395677 42.59153)"," time":"2017-04-25 16:55:50","id":"\x0001"}, {"point ":"POINT (27.396121 42.591096)"," time":"2017-04-25 16:55:55","id":"\x0001"}, {"point ":"POINT (27.395716 42.590597)"," time":"2017-04-25 16:56","id":"\x0001"}, {"point ":"POINT (27.394959 42.590736)"," time":"2017-04-25 16:56:05","id":"\x0001"}, {"point ":"POINT (27.39421 42.591234)"," time":"2017-04-25 16:56:10","id":"\x0001"}, {"point ":"POINT (27.393701 42.592027)"," time":"2017-04-25 16:56:15","id":"\x0001"}, {"point ":"POINT (27.39331 42.592946)"," time":"2017-04-25 16:56:20","id":"\x0001"}, {"point ":"POINT (27.392902 42.593981)"," time":"2017-04-25 16:56:25","id":"\x0001"}, {"point ":"POINT (27.392491 42.595099)"," time":"2017-04-25 16:56:30","id":"\x0001"}, {"point ":"POINT (27.391984 42.596097)"," time":"2017-04-25 16:56:35","id":"\x0001"}, {"point ":"POINT (27.391317 42.596913)"," time":"2017-04-25 16:56:40","id":"\x0001"}, {"point ":"POINT (27.390583 42.597756)"," time":"2017-04-25 16:56:45","id":"\x0001"}, {"point ":"POINT (27.389845 42.598546)"," time":"2017-04-25 16:56:50","id":"\x0001"}, {"point ":"POINT (27.389162 42.599267)"," time":"2017-04-25 16:56:55","id":"\x0001"}, {"point ":"POINT (27.388516 42.599956)"," time":"2017-04-25 16:57","id":"\x0001"}, {"point ":"POINT (27.387899 42.600616)"," time":"2017-04-25 16:57:05","id":"\x0001"}, {"point ":"POINT (27.38733 42.601237)"," time":"2017-04-25 16:57:10","id":"\x0001"}, {"point ":"POINT (27.38673 42.601863)"," time":"2017-04-25 16:57:15","id":"\x0001"} ]

smattheis commented 7 years ago

I need to work it out a bit more, but I won't be able to check that before the weekend. So, maybe I can provide a soluton by sunday or monday.

smattheis commented 7 years ago

Alright, I identified the bug which was introduced with https://github.com/bmwcarit/barefoot/commit/8111991657cd6a053c8e531eda2f15847d63f073 and is given with https://github.com/bmwcarit/barefoot/blob/master/src/main/java/com/bmwcarit/barefoot/matcher/Matcher.java#L177-L188 . I need to think about a solid solution and will provide a bug-fix probably tomorrow.

Side note: I will check if it is related to this bug: https://github.com/bmwcarit/barefoot/issues/27

fil1o commented 7 years ago

Thank you. Your effort is appreciated.

smattheis commented 7 years ago

Fixed in commit https://github.com/bmwcarit/barefoot/commit/952e63f620fa1dba82eb33865be4b130c86e3334 and released in https://github.com/bmwcarit/barefoot/releases/tag/0.1.1 and tested with trace and map of Bulgaria provided with comment https://github.com/bmwcarit/barefoot/issues/56#issuecomment-304843457 . The bug seems to be fixed for that case and originated from a filter that prevents oscillation in case of high-density traces but also filtered candidates by mistake if roads are trespassed backwards. It was not related to issue https://github.com/bmwcarit/barefoot/issues/27 .

fil1o commented 7 years ago

I just checked the latest version. I can confirm it's working as expected.