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
664 stars 185 forks source link

JSON request faulty or incomplete #126

Closed cbrincoveanu closed 5 years ago

cbrincoveanu commented 5 years ago

Hi, first of all thank you for this package. It is great to see that such a tool is available and well documented.

I am currently trying to setup the matcher server and getting some sample outputs. The problem that I have is that the server always seems to regard the input JSON as faulty:

2018-10-02 08:24:55,499 ERROR [pool-2-thread-2] TrackerServer: JSON request faulty or incomplete: {"format": "geojson", "request": [{"point": "POINT (11.564388282625075 48.16350662940509)", "id": "a1396ab7-7caa-4c31-9f3c-8982055e3de6", "time": 1410324847000}, {"point": "POINT (11.565388282625075 48.16250662940509)", "id": "a1396ab7-7caa-4c31-9f3c-8982055e3de6", "time": 1410324851000}]}
java.lang.RuntimeException: JSON request faulty or incomplete: {"format": "geojson", "request": [{"point": "POINT (11.564388282625075 48.16350662940509)", "id": "a1396ab7-7caa-4c31-9f3c-8982055e3de6", "time": 1410324847000}, {"point": "POINT (11.565388282625075 48.16250662940509)", "id": "a1396ab7-7caa-4c31-9f3c-8982055e3de6", "time": 1410324851000}]}
    at com.bmwcarit.barefoot.tracker.TrackerServer$MatcherResponseFactory$2.response(TrackerServer.java:249)
    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)

This error occurs both for the provided sample input as well as the simple JSON input that I assembled for testing.

[
    {"id":"a1396ab7-7caa-4c31-9f3c-8982055e3de6","time":1410324847000,"point":"POINT (11.564388282625075 48.16350662940509)"},
    {"id":"a1396ab7-7caa-4c31-9f3c-8982055e3de6","time":1410324851000,"point":"POINT (11.565388282625075 48.16250662940509)"}
]

I hope you can help me with this issue. Thank you.

smattheis commented 5 years ago

Thanks for the kind feedback! You're sending a request for offline matching to the tracker server which it doesn't accept. The "matcher server" does offline map matching and is able to process your JSON request. The tracker server would accept only single measurements as messages which means as first message {"id":"a1396ab7-7caa-4c31-9f3c-8982055e3de6","time":1410324847000,"point":"POINT (11.564388282625075 48.16350662940509)"} and so on. Do you want to do online/real-time map matching of offline/batch map matching?

cbrincoveanu commented 5 years ago

Thanks for the quick reply. I accidentally started the tracker server instead of the matcher server.