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
665 stars 186 forks source link

Question about ERROR response #100

Closed imtypist closed 6 years ago

imtypist commented 6 years ago

Thank you for contributing to this awesome project! I use barefoot for offline map matching in a large number of input json files, there are only about 1% response is ERROR, what I want to know is that which situation would occur ERROR response?

smattheis commented 6 years ago

An error should never occur. Could you please check if specific traces cause the errors, i.e., can you reproduce the error using the same data? If so, I could try to check it out if you provide the trace and if it's not reproducible the console output of the matcher could help. Best is of course if you can provide both. :)

imtypist commented 6 years ago

I'm happy to receive response quickly! I choose one of ERROR json file and try it again manually, it still said ERROR, and the output response is printed immediately when I press the Enter key as if the procedure never tried to match it. (outputs of other SUCCESS json files would be printed a few seconds later generally) My command line as follow:

python util/submit/batch.py --host localhost --port 1234 --format=slimjson --file bf_json/13229.json

The output is:

root@iZ289uc441qZ:~/barefoot# python util/submit/batch.py --host localhost --port 1234 --format=slimjson --file bf_json/13229.json
ERROR

The test file is attached following: 13229.txt Thank you for your reply~

smattheis commented 6 years ago

The trace that you provided has samples with duplicate timestamps which is a potential contradiction because two samples could have different positions with the same time value. Therefore, the matcher returns an error if sees samples with same time values. As a consequence, you should check your data and remove such duplicates/contradictions. As for example with the trace you provided, you can automate that simply with bash:

$ cat 13229.txt | grep -o '"time": [0-9]*' | uniq -c | grep -v '1 "time"'
      2 "time": 1408327010000

Note that in this example it is a contradiction because the two samples have different positions but same time values:

{"point": "POINT (104.030438 30.688372)", "id": "13229", "time": 1408327010000}, {"point": "POINT (104.031642 30.696178)", "id": "13229", "time": 1408327010000}

Note that the matcher actually points to that problem with its console output:

2018-04-04 15:19:16,200 ERROR [pool-2-thread-2] MatcherServer: multiple samples for same time
java.lang.RuntimeException: multiple samples for same time
    at com.bmwcarit.barefoot.matcher.MatcherServer$InputFormatter.format(MatcherServer.java:83)
    at com.bmwcarit.barefoot.matcher.MatcherServer$MatcherResponseFactory$1.response(MatcherServer.java:287)
    at com.bmwcarit.barefoot.util.AbstractServer$ResponseHandler.call(AbstractServer.java:143)
    at com.bmwcarit.barefoot.util.AbstractServer$ResponseHandler.call(AbstractServer.java:119)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
imtypist commented 6 years ago

Oh..It seems that I asked a stupid question, haha. I started matcher server in the background so I didn't see the console output. there are some duplicates I don't notice before. Thank you for figuring out the question, it helps me a lot!:smile:

smattheis commented 6 years ago

You're welcome. If you find other errors please report it, that helps a lot.