Git Product home page Git Product logo

bmwcarit / barefoot Goto Github PK

View Code? Open in Web Editor NEW
663.0 663.0 185.0 37.77 MB

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.

License: Apache License 2.0

Python 5.66% Shell 0.81% TeX 3.70% PLpgSQL 0.65% Java 87.57% JavaScript 0.34% HTML 1.11% Dockerfile 0.17%
java map map-matching openstreetmap spatial-analysis tracking

barefoot's Issues

Using barefoot with different maps?

Hello,

First, thank you for the great package!

We have an issue when using barefoot with 2 versions of a map. Here is our situation:

  • The map matcher starts processing the first part of a trajectory on the first version of the map (mapV1). It produces a map matching state with candidates identified by id_i, id_j, …
  • The map is then updated to mapV2. Some elements are added or removed.
  • mapV2 is imported to the db using barefoot’s script. As the unique id for each element in the db is computed as the count incremented when an element is imported, the uniqueness is guaranteed for each map but there is no mapping between elements of mapV1 and mapV2. Road id_i in mapV2 and in mapV1 may be different roads.
  • barefoot continues to process the second part of the trajectory on mapV2. But It may fail because its candidates don’t correspond to elements found in mapV2, or the candidates are missing in mapV2.

Do you have any suggestions to solve this problem?
Thanks for any help or advice.

Best regards.

Explanation of server.properties

I am unsure regarding the meaning of some settings in the server.properties. I tried to annotate them with my understanding. If I am wrong, it would be great to become corrected.

# The maximum time is the time after which the work is canceled. But what is the difference between the maximum request and the maximum response time? 
maxRequestTime=30000
maxResponseTime=300000
# Amount of concurrent Connection which is allowed
maxConnectionCount=20
# When do I need to change this number? Does it depend on my hardware, my usage scenario etc.?
numExecutorThreads=40
# The maximum distance between to points. Unit is meter?
matcherMaxDistance=50
# The search radius? Unit is meter?
matcherMaxRadius=50
# Whether every or only every x-th point should be processed
matcherMinInterval=1
# The minimum distance which should lie between two points. Unit is meter?
matcherMinDistance=0
# When do I need to change this number? For maximum performance should it be equal to the amount of cores I have?
matcherNumThreads=8```

Problem: Monitor Script could not handle receiving messages from TrackerServer on german localized system

Since string conversation of floating numbers in Java depends on the system localization, results of ESRI GeometryEngine.geometryToWkt will have comma seperated float numbers on a german localized system (or other localization with comma seperated floating numbers). This will lead in errors while handle received points with the included Node.JS monitoring tools.

Solution: add -Duser.language=en -Duser.country=US` to java programm call to enforce localization with dot seperated floating numbers.

Could it usefull to extend wiki pages with this information of handling java based services of barefoot?

Not able to start matcher server

Thanks for this great library and the comprehensive instructions. It's an excellent piece of work!

I followed your instructions carefully and successfully started a map server with an imported OSM extract. Unfortunately, I'm experiencing an issue while trying to start a matcher server. After packaging the Barefoot JAR, I ran the following command and got the following output:

root@f1cc0014739b:/mnt# java -jar target/barefoot-0.1.0-matcher-jar-with-dependencies.jar --geojson config/server.properties config/switzerland.properties
2016-10-11 16:49:55,704 INFO [main] ServerControl: initialize server
2016-10-11 16:49:55,713 INFO [main] ServerControl: read database properties from file config/switzerland.properties
2016-10-11 16:49:55,719 INFO [main] Loader: load map from database switzerland
2016-10-11 16:49:55,721 INFO [main] Loader: open road reader for database switzerland at 127.0.0.1:5432
2016-10-11 16:49:55,722 INFO [main] Loader: database.host=127.0.0.1
2016-10-11 16:49:55,722 INFO [main] Loader: database.port=5432
2016-10-11 16:49:55,723 INFO [main] Loader: database.name=switzerland
2016-10-11 16:49:55,724 INFO [main] Loader: database.table=ways
2016-10-11 16:49:55,725 INFO [main] Loader: database.user=postgres
2016-10-11 16:49:55,725 INFO [main] Loader: database.road-types=./map/tools/road-types.json
2016-10-11 16:49:55,784 INFO [main] PostGISReader: open reader (standard)
2016-10-11 16:49:55,787 INFO [main] PostGISReader: open reader (parameterized)
2016-10-11 16:49:55,944 INFO [main] RoadMap: inserting roads ...
2016-10-11 16:49:55,948 INFO [main] PostGISReader: execute query
2016-10-11 16:49:56,003 ERROR [main] ServerControl: Executing PostgreSQL query failed: ERROR: column "gid" does not exist
Position: 8
2016-10-11 16:49:56,007 INFO [Thread-0] ServerControl: stopping server
2016-10-11 16:49:56,009 ERROR [Thread-0] ServerControl: stopping server failed, not yet started

Seems as if the table ways is missing a column. Please note: The import of the OSM extract was successful and showed no errors.

I'd appreciate any help on this one.

JSON request faulty or incomplete

Thanks again for this awesome library and sorry for bothering again.

I'm experiencing a weird issue. I managed to start a matcher server and successfully retrieve some matching points for a set of given GPS coordinates. However, after restarting the matcher server and submitting the same sample data again, the matcher server returns the following error:

2016-10-12 13:37:46,841 ERROR [pool-2-thread-24] TrackerServer: JSON request faulty or incomplete: {"format": "geojson", "request": [{"time": "2014-09-10 06:54:07+0200", "id": "\\x0001", "point": "POINT(9.39050628 47.43421293)"}, {"time": "2014-09-10 06:54:22+0200", "id": "\\x0001", "point": "POINT(9.39047829 47.43405053)"}, {"time": "2014-09-10 06:54:37+0200", "id": "\\x0001", "point": "POINT(9.39040549 47.43400307)"}, {"time": "2014-09-10 06:54:52+0200", "id": "\\x0001", "point": "POINT(9.39048218 47.4339819)"}, {"time": "2014-09-10 06:55:07+0200", "id": "\\x0001", "point": "POINT(9.39050034 47.43392939)"}, {"time": "2014-09-10 06:55:22+0200", "id": "\\x0001", "point": "POINT(9.39052741 47.43386315)"}, {"time": "2014-09-10 06:55:37+0200", "id": "\\x0001", "point": "POINT(9.39053714 47.43379712)"}, {"time": "2014-09-10 06:55:52+0200", "id": "\\x0001", "point": "POINT(9.39056102 47.43372544)"}, {"time": "2014-09-10 06:56:07+0200", "id": "\\x0001", "point": "POINT(9.39057812 47.43367572)"}, {"time": "2014-09-10 06:56:22+0200", "id": "\\x0001", "point": "POINT(9.39060296 47.43362181)"}, {"time": "2014-09-10 06:56:37+0200", "id": "\\x0001", "point": "POINT(9.39062649 47.43357349)"}, {"time": "2014-09-10 06:56:52+0200", "id": "\\x0001", "point": "POINT(9.39064449 47.43352041)"}, {"time": "2014-09-10 06:57:07+0200", "id": "\\x0001", "point": "POINT(9.39066988 47.43347638)"}, {"time": "2014-09-10 06:57:22+0200", "id": "\\x0001", "point": "POINT(9.39069002 47.43341559)"}, {"time": "2014-09-10 06:57:37+0200", "id": "\\x0001", "point": "POINT(9.39072274 47.43335014)"}, {"time": "2014-09-10 06:57:52+0200", "id": "\\x0001", "point": "POINT(9.3907569 47.43329393)"}, {"time": "2014-09-10 06:58:07+0200", "id": "\\x0001", "point": "POINT(9.3907865 47.43323207)"}, {"time": "2014-09-10 06:58:22+0200", "id": "\\x0001", "point": "POINT(9.39078946 47.43317082)"}, {"time": "2014-09-10 06:58:37+0200", "id": "\\x0001", "point": "POINT(9.39082222 47.43313115)"}]}
java.lang.RuntimeException: JSON request faulty or incomplete: {"format": "geojson", "request": [{"time": "2014-09-10 06:54:07+0200", "id": "\\x0001", "point": "POINT(9.39050628 47.43421293)"}, {"time": "2014-09-10 06:54:22+0200", "id": "\\x0001", "point": "POINT(9.39047829 47.43405053)"}, {"time": "2014-09-10 06:54:37+0200", "id": "\\x0001", "point": "POINT(9.39040549 47.43400307)"}, {"time": "2014-09-10 06:54:52+0200", "id": "\\x0001", "point": "POINT(9.39048218 47.4339819)"}, {"time": "2014-09-10 06:55:07+0200", "id": "\\x0001", "point": "POINT(9.39050034 47.43392939)"}, {"time": "2014-09-10 06:55:22+0200", "id": "\\x0001", "point": "POINT(9.39052741 47.43386315)"}, {"time": "2014-09-10 06:55:37+0200", "id": "\\x0001", "point": "POINT(9.39053714 47.43379712)"}, {"time": "2014-09-10 06:55:52+0200", "id": "\\x0001", "point": "POINT(9.39056102 47.43372544)"}, {"time": "2014-09-10 06:56:07+0200", "id": "\\x0001", "point": "POINT(9.39057812 47.43367572)"}, {"time": "2014-09-10 06:56:22+0200", "id": "\\x0001", "point": "POINT(9.39060296 47.43362181)"}, {"time": "2014-09-10 06:56:37+0200", "id": "\\x0001", "point": "POINT(9.39062649 47.43357349)"}, {"time": "2014-09-10 06:56:52+0200", "id": "\\x0001", "point": "POINT(9.39064449 47.43352041)"}, {"time": "2014-09-10 06:57:07+0200", "id": "\\x0001", "point": "POINT(9.39066988 47.43347638)"}, {"time": "2014-09-10 06:57:22+0200", "id": "\\x0001", "point": "POINT(9.39069002 47.43341559)"}, {"time": "2014-09-10 06:57:37+0200", "id": "\\x0001", "point": "POINT(9.39072274 47.43335014)"}, {"time": "2014-09-10 06:57:52+0200", "id": "\\x0001", "point": "POINT(9.3907569 47.43329393)"}, {"time": "2014-09-10 06:58:07+0200", "id": "\\x0001", "point": "POINT(9.3907865 47.43323207)"}, {"time": "2014-09-10 06:58:22+0200", "id": "\\x0001", "point": "POINT(9.39078946 47.43317082)"}, {"time": "2014-09-10 06:58:37+0200", "id": "\\x0001", "point": "POINT(9.39082222 47.43313115)"}]}
    at com.bmwcarit.barefoot.tracker.TrackerServer$MatcherResponseFactory$2.response(TrackerServer.java:246)
    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:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)

I ran the following command:

root@f1cc0014739b:/mnt# python util/submit/batch.py --host localhost --port 1234  --file src/test/resources/com/bmwcarit/barefoot/matcher/sample.json

Here's the content of sample.json:

[{"point":"POINT(9.39050628 47.43421293)","time":"2014-09-10 06:54:07+0200","id":"\\x0001"},{"point":"POINT(9.39047829 47.43405053)","time":"2014-09-10 06:54:22+0200","id":"\\x0001"},{"point":"POINT(9.39040549 47.43400307)","time":"2014-09-10 06:54:37+0200","id":"\\x0001"},{"point":"POINT(9.39048218 47.4339819)","time":"2014-09-10 06:54:52+0200","id":"\\x0001"},{"point":"POINT(9.39050034 47.43392939)","time":"2014-09-10 06:55:07+0200","id":"\\x0001"},{"point":"POINT(9.39052741 47.43386315)","time":"2014-09-10 06:55:22+0200","id":"\\x0001"},{"point":"POINT(9.39053714 47.43379712)","time":"2014-09-10 06:55:37+0200","id":"\\x0001"},{"point":"POINT(9.39056102 47.43372544)","time":"2014-09-10 06:55:52+0200","id":"\\x0001"},{"point":"POINT(9.39057812 47.43367572)","time":"2014-09-10 06:56:07+0200","id":"\\x0001"},{"point":"POINT(9.39060296 47.43362181)","time":"2014-09-10 06:56:22+0200","id":"\\x0001"},{"point":"POINT(9.39062649 47.43357349)","time":"2014-09-10 06:56:37+0200","id":"\\x0001"},{"point":"POINT(9.39064449 47.43352041)","time":"2014-09-10 06:56:52+0200","id":"\\x0001"},{"point":"POINT(9.39066988 47.43347638)","time":"2014-09-10 06:57:07+0200","id":"\\x0001"},{"point":"POINT(9.39069002 47.43341559)","time":"2014-09-10 06:57:22+0200","id":"\\x0001"},{"point":"POINT(9.39072274 47.43335014)","time":"2014-09-10 06:57:37+0200","id":"\\x0001"},{"point":"POINT(9.3907569 47.43329393)","time":"2014-09-10 06:57:52+0200","id":"\\x0001"},{"point":"POINT(9.3907865 47.43323207)","time":"2014-09-10 06:58:07+0200","id":"\\x0001"},{"point":"POINT(9.39078946 47.43317082)","time":"2014-09-10 06:58:22+0200","id":"\\x0001"},{"point":"POINT(9.39082222 47.43313115)","time":"2014-09-10 06:58:37+0200","id":"\\x0001"}]

Can you think of any reason why the matcher server does not accept my sample.json file anymore? It seems as if there's something wrong with my json file, but then again why was it successful in the first run? Restarting the matcher server did not help. The matcher server does not accept any json file anymore.

Thanks for your help!

HMM breaks/no output

Thank you for providing an excellent library with clear instructions. Great stuff.

I appreciate you must be busy with other things, but if you have ideas of other trouble shooting steps I could try, that'd be appreciated. I'm not getting any points matched at all (against greater london OSM data), with the following input data (extract below).

The matcher returns:

python util/submit/batch.py --host localhost --port 1234  --file src/test/resources/com/bmwcarit/barefoot/matcher/oc-epoch.json 
SUCCESS
{"type":"MultiLineString","coordinates":[]}

i.e. SUCCESS, but no points.

My vehicle GPS data is sampled every 3 seconds in CSV format, so I've had to convert this to the JSON notation expected by barefoot, using the excellent convertcsv.com. Sample:

INDEX,TRACK ID,VALID,UTC DATE,UTC TIME,LOCAL DATE,LOCAL TIME,MS,LATITUDE,N/S,LONGITUDE,E/W,ALTITUDE,SPEED,HEADING,G-X,G-Y,G-Z
1,1,FIXED,2016/8/4,6:35:35,2016/8/4,7:35:35,0,51.517646,N,0.125068,W,175.360855,1.177967,129.215155,0.000000,0.000000,0.000000
2,1,FIXED,2016/8/4,6:35:38,2016/8/4,7:35:38,0,51.517613,N,0.125003,W,174.322067,0.760424,166.866982,0.000000,0.000000,0.000000
3,1,FIXED,2016/8/4,6:35:41,2016/8/4,7:35:41,0,51.517575,N,0.124989,W,169.738327,0.245582,182.416140,0.000000,0.000000,0.000000
4,1,FIXED,2016/8/4,6:35:44,2016/8/4,7:35:44,0,51.517533,N,0.124991,W,163.670990,0.177307,177.674236,0.000000,0.000000,0.000000
5,1,FIXED,2016/8/4,6:35:47,2016/8/4,7:35:47,0,51.517524,N,0.124991,W,155.395676,0.071991,340.255272,0.000000,0.000000,0.000000

Convert template (assuming date stamps are already imported into Excel time converted to UNIX time, thus =(A2-25569)*86400000:

{lb}"id":"\\x0001","point":"POINT(-{f4} {f3})","time":{f2}000{rb}

Note, I've had to turn the degrees west into negative degrees East (this looks reasonable when overlaid on the map), and reverse it to LongLat, c.f. Issue 17.

I've also just tried turning the datestamp into epoch time (in ms), c.f. request message format on the wiki. Links to Datestamp version and Epoch version

[
{"id":"\\x0001","point":"POINT(-0.125068 51.517646)","time":1470468935000},
{"id":"\\x0001","point":"POINT(-0.125003 51.517613)","time":1470468938000},
{"id":"\\x0001","point":"POINT(-0.124989 51.517575)","time":1470468941000},
{"id":"\\x0001","point":"POINT(-0.124991 51.517533)","time":1470468944000},
{"id":"\\x0001","point":"POINT(-0.124991 51.517524)","time":1470468947000},
{"id":"\\x0001","point":"POINT(-0.125006 51.517549)","time":1470468950000}
]

If you can think of other reasons I might be getting the HMM breaks & no points snapped, I'd really appreciate your thoughts. If there's further debug information I can enable to help find the problem, I'm happy to do that.

Unable to find example of online Map maching

I have stream of latitude and longitude which I want to use for map matching. But I haven't found any good example by which I will be able to achieve this. I am looking for something which will take these latitude and longitude stream and outputs latitude and longitude corresponding to road. Could you you help me with this?

Tracker server output format

Asked by @mmunko:
"I would like to ask, is there a way how to reduce output pushed by websocket only to most probable route, skipping candidates.

Also is there any way how to send som additional information to the tracker, for example, if the vehicle has lights on, etc...., basicly it would be great if I could send set of optional attributes along with the point and in the result, they will appear in the response, e.g. as a separate object, where it will be index of a point in the route and these attributes."

cannot create db with default import.sh

I followed the instruction then got this message:

root@acef54deeedb# bash /mnt/map/osm/import.sh
createdb: database creation failed: ERROR:  could not stat file "base/1/pg_internal.init": 
No such file or directory

Any guide for this? (OS : CentOS 7.3)

Matcher server Opening PostgreSQL connection failed

I followed the Matcher server part. In step 3 I got the following error.

$ java -jar target/barefoot-0.1.0-matcher-jar-with-dependencies.jar --geojson config/server.properties config/oberbayern.properties
2017-02-08 15:34:18,022 INFO  [main] ServerControl: initialize server
2017-02-08 15:34:18,027 INFO  [main] ServerControl: read database properties from file config/oberbayern.properties
2017-02-08 15:34:18,029 INFO  [main] Loader: load map from database oberbayern
2017-02-08 15:34:18,029 INFO  [main] Loader: open road reader for database oberbayern at localhost:5432
2017-02-08 15:34:18,029 INFO  [main] Loader: database.host=localhost
2017-02-08 15:34:18,030 INFO  [main] Loader: database.port=5432
2017-02-08 15:34:18,030 INFO  [main] Loader: database.name=oberbayern
2017-02-08 15:34:18,030 INFO  [main] Loader: database.table=bfmap_ways
2017-02-08 15:34:18,030 INFO  [main] Loader: database.user=osmuser
2017-02-08 15:34:18,030 INFO  [main] Loader: database.road-types=./map/tools/road-types.json
2017-02-08 15:34:18,065 INFO  [main] PostGISReader: open reader (standard)
2017-02-08 15:34:18,065 INFO  [main] PostGISReader: open reader (parameterized)
2017-02-08 15:36:25,268 ERROR [main] ServerControl: Opening PostgreSQL connection failed: The connection attempt failed.
2017-02-08 15:36:25,269 INFO  [Thread-0] ServerControl: stopping server
2017-02-08 15:36:25,270 ERROR [Thread-0] ServerControl: stopping server failed, not yet started

Thanks for your helps.

Points are not matched properly

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

Question: cannot see the result in http://localhost:3000 when the time interval is 45s

I have a dataset which is achieved in 1Hz and I change the time interval to 45s, then dataset was as below:
[ {"id":"1","time":1381601722000,"point":"POINT(-37.798779 144.947925)"}, {"id":"2","time":1381601766000,"point":"POINT(-37.79859 144.946681)"}, {"id":"3","time":1381601811000,"point":"POINT(-37.79567 144.946641)"}, {"id":"4","time":1381601856000,"point":"POINT(-37.793667 144.947059)"}, {"id":"5","time":1381601901000,"point":"POINT(-37.793649 144.94706)"}, {"id":"6","time":1381601946000,"point":"POINT(-37.790623 144.94347)"}, {"id":"7","time":1381601991000,"point":"POINT(-37.789682 144.942368)"}, {"id":"8","time":1381602036000,"point":"POINT(-37.78931 144.94186)"}, {"id":"9","time":1381602081000,"point":"POINT(-37.786719 144.941969)"}, {"id":"10","time":1381602126000,"point":"POINT(-37.781414 144.941971)"}, {"id":"11","time":1381602171000,"point":"POINT(-37.776424 144.942933)"}, {"id":"12","time":1381602216000,"point":"POINT(-37.775427 144.945269)"}, {"id":"13","time":1381602261000,"point":"POINT(-37.775407 144.94885)"}, {"id":"14","time":1381602306000,"point":"POINT(-37.7709 144.949668)"}, {"id":"15","time":1381602351000,"point":"POINT(-37.770247 144.949717)"}, {"id":"16","time":1381602396000,"point":"POINT(-37.76955 144.944293)"}, {"id":"17","time":1381602441000,"point":"POINT(-37.76568 144.94356)"}, {"id":"18","time":1381602486000,"point":"POINT(-37.764993 144.944689)"}, {"id":"19","time":1381602531000,"point":"POINT(-37.765779 144.944819)"}, {"id":"20","time":1381602576000,"point":"POINT(-37.765779 144.944842)"}, {"id":"21","time":1381602621000,"point":"POINT(-37.765797 144.944841)"}, {"id":"22","time":1381602666000,"point":"POINT(-37.766259 144.947255)"}, {"id":"23","time":1381602711000,"point":"POINT(-37.765861 144.949147)"}, {"id":"24","time":1381602756000,"point":"POINT(-37.765888 144.952773)"}, {"id":"25","time":1381602801000,"point":"POINT(-37.766713 144.959587)"}, {"id":"26","time":1381602846000,"point":"POINT(-37.766998 144.962017)"}, {"id":"27","time":1381602891000,"point":"POINT(-37.766992 144.962038)"}, {"id":"28","time":1381602936000,"point":"POINT(-37.765557 144.963223)"}, {"id":"29","time":1381602981000,"point":"POINT(-37.766301 144.970226)"}, {"id":"30","time":1381603026000,"point":"POINT(-37.766576 144.973278)"}, {"id":"31","time":1381603071000,"point":"POINT(-37.767166 144.978804)"}, {"id":"32","time":1381603116000,"point":"POINT(-37.76727 144.979882)"}, {"id":"33","time":1381603161000,"point":"POINT(-37.767511 144.984724)"}, {"id":"34","time":1381603206000,"point":"POINT(-37.768281 144.990439)"}, {"id":"35","time":1381603251000,"point":"POINT(-37.767117 144.99148)"}, {"id":"36","time":1381603296000,"point":"POINT(-37.761218 144.992643)"}, {"id":"37","time":1381603341000,"point":"POINT(-37.756587 144.993618)"}, {"id":"38","time":1381603386000,"point":"POINT(-37.752244 144.994718)"}, {"id":"39","time":1381603431000,"point":"POINT(-37.749637 144.995701)"}, {"id":"40","time":1381603476000,"point":"POINT(-37.746244 144.996876)"}, {"id":"41","time":1381603521000,"point":"POINT(-37.744987 144.997368)"}, {"id":"42","time":1381603566000,"point":"POINT(-37.744998 144.99739)"}, {"id":"43","time":1381603611000,"point":"POINT(-37.745126 145.002703)"}, {"id":"44","time":1381603656000,"point":"POINT(-37.745119 145.002742)"}, {"id":"45","time":1381603701000,"point":"POINT(-37.745567 145.007247)"}, {"id":"46","time":1381603746000,"point":"POINT(-37.746385 145.015173)"}, {"id":"47","time":1381603791000,"point":"POINT(-37.747081 145.021043)"}, {"id":"48","time":1381603836000,"point":"POINT(-37.747071 145.021092)"}, {"id":"49","time":1381603881000,"point":"POINT(-37.747854 145.027653)"}, {"id":"50","time":1381603926000,"point":"POINT(-37.748895 145.033377)"}, {"id":"51","time":1381603971000,"point":"POINT(-37.748638 145.036434)"}, {"id":"52","time":1381604016000,"point":"POINT(-37.748582 145.036447)"}, {"id":"53","time":1381604061000,"point":"POINT(-37.747892 145.036903)"}, {"id":"54","time":1381604106000,"point":"POINT(-37.747603 145.039752)"}, {"id":"55","time":1381604151000,"point":"POINT(-37.749438 145.04146)"}, {"id":"56","time":1381604196000,"point":"POINT(-37.749467 145.041445)"} ]
then I run the Tracker server and it returned "SUCCESS" for each point after 30-40s, however, I cannot see the red pot, which means the online map matching result, in http://localhost:3000. But I can see the red pot when I use the whole dataset whose time interval is 1Hz. How can I get the final result in json or other format so that I can visualize the result in http://geojson.io/? I use the melbourne.osm.pbf file from https://mapzen.com/data/metro-extracts/metro/melbourne_australia/ and the default road-types.json. The whole dataset is here http://people.eng.unimelb.edu.au/henli/projects/map-matching/gps_track.txt.

I also run the matcher server. The Matcher Server is successfully set up but return empty coordinates list.
user@user-VirtualBox:~/barefoot$ python util/submit/batch.py --host localhost --port 1235 --file 45.json SUCCESS {"coordinates":[],"type":"MultiLineString"}
And when I looked at the server, I found the info that "HMM break - no state emissions".

Here is Server Properties:
server.port=1234 server.timeout.request=15000 server.timeout.response=6000000 server.connections=20 matcher.sigma=4.5 matcher.lambda=0.0 matcher.distance.max=15000 matcher.radius.max=500 matcher.interval.min=1000 matcher.distance.min=0 matcher.threads=8

and Tracker Properties is:
server.port=1234 server.timeout.request=500 server.timeout.response=1000 server.connections=100 matcher.sigma=5 matcher.lambda=0.0 matcher.distance.max=5000 matcher.radius.max=50 matcher.interval.min=1000 matcher.distance.min=0 matcher.threads=8 tracker.state.ttl=60 tracker.port=1235

road-types.json- add track tag

Hi, I want to include track highway tag into my database. Is adding:

{
    "name":"track",
    "id":116,
    "priority":5,
    "maxspeed":50
}

enough? How much, do you think, it will affect the import time?

Miscellaneous issues wrt offline matching and "id" in input

Hi, first thank you greatly for this package, it has made my life much easier and is very easy to implement.

My issues are already resolved to the extent things are working, but I want to clarify why they're working lest I have problems later.

By background, I am matching a large amount of data - currently 19 million points for 1500 vehicles (with more in future) covering a continent with heterogeneity in frequency and gps accuracy because the sources are varied. My main purpose is determining information about the road network.

After small scale testing and rewriting of sections to return desired information (thanks for your comments elsewhere here) I started feeding Barefoot json files (with the batch.py script), each representing a separate vehicle. However the 'id' variable in the json represented a "trip", which I had designated through earlier processing. This removes stationary periods from the data, but also separate groups of pings distinct in time and space. Sometimes these gaps occur because there were a long string of erroneous values which I had to filter out.

Most vehicles processed fine, but a number would always time out, even with server properties allowing very generous intervals (up to half an hour). I did not reduce the max search distance below 6 km because the lower frequency of data from some sources likely meant vehicles were travelling further than that between pings.

Eventually I started feeding individual trips so I could pin point exactly where problems were occurring - and everything worked!

So, what I think is happening

  1. The id variable is only used to identify output, but not change processing - this is hinted at in the documentation but wasn't entirely clear, and a user, like me, may have expected they could feed a bunch of vehicles in one json file.
  2. Barefoot was failing where a vehicle had jumped a large distance, particularly from a point in an urban area. Whilst the jump was between two trip ids, barefoot was still trying to route between them subject to max distance, but with a very large number of options.

Does this seem plausible? If so everything is fine. I'm assuming I am an unusual case, but this leads to two suggestions.

  1. Slight clarification of what the "id" value does and does not do.
  2. A switch that first checks if the "crows' fly" (great circle) distance between two points is greater than the max route distance, at least for points with a larger than normal time interval. Since the shortest route can't logically be less than the straight line, this would avoid trying to find a route in these circumstances.

Once again, thankyou!

porting to c++ and using sqlite

dear all
i want to write a map matching software based on barefoot with c++ that works fine on embedded systems for an IVI module. i will publish it opensource along with its proper openembedded layer.
the thing is that i am trying to choose a map database solution. does make sense to ddirectly use sqlite or should turn to something else?
thank you all in advance

Barefoot freezes

Hi, I imported Europe extract on my server machine (Xeon E5 1620V3, 96GB RAM, 4TB HDD) and I noticed that Barefoot hangs from time to time for about 25-27 seconds, after that time it continues to work as expected. Can it be related to fact that I set -Xmx and -Xms to 64g and it's just not enough? Screenshot:

ss

Timeout error on matching server

Hi! I'm trying to call the matching server using the following command:

$ python util/submit/batch.py --host localhost --port 1234  --file samples/sample.json

where the contents of sample.json are (coordinates in Singapore, time between consecutive points is around 10 seconds)

[
  {"id":"1", "time":1478473108000, "point":"POINT (1.32918 103.926589)"},
  {"id":"2", "time":1478473119000, "point":"POINT (1.329221 103.925728)"},
  {"id":"3", "time":1478473130000, "point":"POINT (1.329668 103.924459)"},
  {"id":"4", "time":1478473139000, "point":"POINT (1.32956 103.924051)"},
  {"id":"5", "time":1478473150000, "point":"POINT (1.329864 103.922148)"}
]

I was able to setup the matching server using a singapore.osm.pbf, and I also double checked the docker container's database if it's populated. So far everything's okay.

But when I run the batch.py script above on the command line, I get

$ python util/submit/batch.py --host localhost --port 1234  --file sample/sample.json         [ruby-2.3.3]
TIMEOUT

Also, the matching server logs says:

2017-02-09 15:53:03,339 ERROR [Thread-13] AbstractServer: 127.0.0.1:51529 request handler timeout

I also tried the following approaches just to check if I'm missing some aspect/s of the setup:

  • I was using a custom built .osm.pbf file for the importing. So I tried to use a pre-built one for Singapore (https://mapzen.com/data/metro-extracts/metro/singapore/). Then, I re-did the data importing and server setup process, but still get the timeout.
  • I'm using the default road-types.json provided for the road type configuration. I tried to change the sample.json input above so that the points are located along a highway in Singapore. I still get the timeout.

Here's what my server.properties have, just in case it's needed:

server.port=1234
server.timeout.request=5000
server.timeout.response=60000
server.connections=20
matcher.sigma=4.5
matcher.lambda=0.0
matcher.distance.max=15000
matcher.radius.max=200
matcher.interval.min=1000
matcher.distance.min=0
matcher.threads=8

Hope you can help. Thank you!

Calculating distance for each road ID returned in debug format

Hi, as far as I understand, right now, in debug response format, Barefoot returns matched geometry along with a set of road IDs the car was travelling on (if I'm wrong, please correct me). I would like to know which points from returned geometry belongs to each road ID to calculate distances or percentage values of each road ID in every returned segment. Is there a way to modify Barefoot's response format to include such data?

Thanks in advance for your help!

BareFoot with H2GIS

Hi,

H2GIS is a 100% java standalone spatial database able to import openstreetmap data . Can you give us some guidelines in order to link through jdbc barefoot to a localhost h2gis database then doing map matching ?

Thanks

Routing distance between matched points

First of all, this library is amazing! Thanks so much for providing us with such great work.

Is there any simple way to include the routing distance between two matched points in the debug output (e.g. by changing the source code)? To make my point clear, I'd like to give an example. For instance, the following JSON sample shows two matched points for two given GPS points. I'd like to include the routing distance between POINT (9.37383970739068 47.429504725440154) and POINT (9.373731696208619 47.429421380914064).

I'm thankful for any advice!

{
    "id": "bad25e18-4fb8-4874-9561-c8a3ac02081b",
    "point": {
      "road": 374570,
      "heading": "forward",
      "frac": 0.038874758720377
    },
    "time": 1457954691,
    "road_edge": 749140,
    "seqprob": -2.5891656830773,
    "geom": "LINESTRING (9.3738989 47.4295504, 9.3738989 47.4295504, 9.37383970739068 47.429504725440154)",
    "transition": {
      "route": {
        "source": {
          "road": 374570,
          "heading": "backward",
          "frac": 1
        },
        "target": {
          "road": 374570,
          "heading": "forward",
          "frac": 0.038874758720377
        },
        "roads": [
          {
            "road": 374570,
            "heading": "backward"
          },
          {
            "road": 374570,
            "heading": "forward"
          }
        ]
      }
    },
    "point_matched": "POINT (9.37383970739068 47.429504725440154)",
    "filtprob": 0.31211030877409,
    "frac": 0.038874758720377
  },
  {
    "id": "90b458bf-de66-4a6e-8675-7b38904a212a",
    "point": {
      "road": 374570,
      "heading": "forward",
      "frac": 0.10981129879372
    },
    "time": 1457954692,
    "road_edge": 749140,
    "seqprob": -4.2432779916644,
    "geom": "LINESTRING (9.37383970739068 47.429504725440154, 9.373731696208619 47.429421380914064)",
    "transition": {
      "route": {
        "source": {
          "road": 374570,
          "heading": "forward",
          "frac": 0.038874758720377
        },
        "target": {
          "road": 374570,
          "heading": "forward",
          "frac": 0.10981129879372
        },
        "roads": [
          {
            "road": 374570,
            "heading": "forward"
          }
        ]
      }
    },
    "point_matched": "POINT (9.373731696208619 47.429421380914064)",
    "filtprob": 0.40308485166153,
    "frac": 0.10981129879372
  }

System.exit() incompatible with Maven Surefire

An incompatibility of Maven test execution with System.exit() calls causes Maven test execution to crash instead of reporting a failure. This requires replacement of System.exit() calls with appropriate exception handling and System.exit() calls only in main methods. The root cause exception is:

Caused by: java.lang.RuntimeException: The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
Command was /bin/sh -c cd /home/rahim/barefoot && /usr/local/java/jdk1.8.0_77/jre/bin/java -jar /home/rahim/barefoot/target/surefire/surefirebooter291619504520303315.jar /home/rahim/barefoot/target/surefire/surefire1342468510559717990tmp /home/rahim/barefoot/target/surefire/surefire_06724258432144963638tmp
	at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:485)
	at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:352)
	at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:158)
	at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:967)
	at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:831)
	at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:729)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
	... 21 more

confusing map matching results & errors

Hello, first of all thanks for an amazing work on the barefoot library. I'd like to use barefoot in my masters thesis as a map matching component, the aim of my research is to augment road speed information for road segments with contextual information such as weather or time context to improve the accuracy traffic dynamics prediction. To do so I have to extract speed from raw GPS traces and map it to underlying street graph (that is where barefoot would come really handy).

I have followed the manual, set up the docker container as described and imported a reasonable chunk of osm data for my needs without any major problem, but when I attempt to run the "hello-world" map-matching example, the GPS trace is not mapped correctly. For example consider this raw gps trace:

raw

Which gets mapped as:

bad

I used the example provided, and did a null-check on transition, because it was raising NullPointer

// Iterative map matching of sample batch (offline) or sample stream (online)
        for (MatcherSample sample : samples) {
            Set<MatcherCandidate> vector = matcher.execute(state.vector(), state.sample(),
                    sample);
            state.update(vector, sample);

            //  Online map matching result
            MatcherCandidate estimate = state.estimate(); // most likely position estimate

            if(estimate != null) {
                long id = estimate.point().edge().id(); // road id
                Point position = estimate.point().geometry(); // position

                System.out.println(position.getY() + ", " + position.getX() + ", " + sample.time() );

                MatcherTransition transition = estimate.transition();
                if(transition != null) {
                    Route route = transition.route(); // route to position
                }
            } else {
                System.out.println("no estimate");
            }
        }

and I instantiate the MatcherSamples like so

Point point = new Point(lng, lat);
MatcherSample ms = new MatcherSample(time.toString(), time, point);

Additionally, I have found out, that multiple successive points often get mapped to an identical resulting position and in output i get Filter: HMM break - no state transitions. I get the impression as if it the road graph was incorrect or maybe my MatcherSamples lacked the definition of a correct spatial reference and thus were not matched correctly. Is there something I might have overlooked that might have caused this issue?

Thanks

Should direction of vehicle be passed as heading or azimuth.

In the docs, under the tracker section, there is a list of parameters in the request listed.
One of the params is heading, but in the source code in the https://github.com/bmwcarit/barefoot/blob/master/src/main/java/com/bmwcarit/barefoot/matcher/MatcherSample.java, in the lines 91-102 there is:

    public MatcherSample(JSONObject json) throws JSONException {
        super(json);
        id = json.getString("id");
        String wkt = json.getString("point");
        point = (Point) GeometryEngine.geometryFromWkt(wkt, WktImportFlags.wktImportDefaults,
                Type.Point);
        if (json.has("azimuth")) {
            azimuth = norm(json.getDouble("azimuth"));
        } else {
            azimuth = Double.NaN;
        }
}

Constructor checks for "azimuth" in the json.

Matcher Server SUCCESS but return empty coordinates list

I am using the dataset from Hengfeng Li project people.eng.unimelb.edu.au/henli/projects/map-matching and the dataset is here http://people.eng.unimelb.edu.au/henli/projects/map-matching/gps_track.txt. I start the Matcher Server and run the code
user@user-VirtualBox:~/barefoot$ python util/submit/batch.py --host localhost --port 1235 --file test.json
where the contents of test.json are
[ {"id":"1","time":1381601722,"point":"POINT(144.947925 -37.798779)"}, {"id":"2","time":1381601723,"point":"POINT(144.947900 -37.798449)"}, {"id":"3","time":1381601724,"point":"POINT(144.947885 -37.798749)"} ]

The Matcher Server is successfully set up but return empty coordinates list.
user@user-VirtualBox:~/barefoot$ python util/submit/batch.py --host localhost --port 1235 --file test.json SUCCESS {"coordinates":[],"type":"MultiLineString"}
Are there something wrong with my setup? I use the melbourne.osm.pbf file from https://mapzen.com/data/metro-extracts/metro/melbourne_australia/ and the default road-types.json

Less u-turns

Hi,
I'm looking to see if I can use barefoot for my projects, and run into this in my first test. My raw data is as follows
image
and when I match, I get points onto Kurze Muhren (point 27), which was actually never driven on. Is there a way to match point 27 onto some other road (Bransende in this case)? I'm running everything right now with default parameters.

Performance and WGS84

Hello:

This project is just awesome! You author(s) and contributors did a great job, it really helps me a lot.

I found Barefoot is slow while I using real world taxi GPS data: it took about 4 seconds to match 240 GPS samples in my laptop(CPU: i7-2650M, RAM: 8GB).

After profiling with JProfiler, the function Geography.distance() seems to be executed so much times that made it to be a performance bottle-neck.

So my question is: can I use a planar CRS like EPSG:3857 instead of WGS84 to accelerate the distance computing function?

Cheers!

Quick Start on MacOS using docker-machine

I really like your MapMatching Algorithm Proposal and wanted to try. Since it took me some time to make it work using docker-machine (should be kind of similar for boot2docker) I want to share my insights for others:

First you should consider creating yourself a new docker-machine since the container requires even in standard installation 6.5GB. This command creates a new instance of 30GB using virtualbox.
docker-machine create -d virtualbox --virtualbox-disk-size "30000" default

Next follow the Quick Start Guide regarding the Map server but:

  • leave out the sudo in all commands
  • At Step 4: Exchange 172.17.0.0 for the ip you get using docker-machine ip <name of docker-machine instance>

Having your container up you will need to edit the PostGIS security configuration (of course, this configuration is only for testing, don't use it for production):
echo host all all 0.0.0.0/0 md5 >> /etc/postgresql/9.3/main/pg_hba.conf
You will need to restart the container or at least PostGIS for the changes to take place

After this change the host ip in config/oberbayern.properties again for the ip of your docker-machine instance ( docker-machine ip <name of docker-machine instance>)

Now you can follow the second part of the quick start regarding map matching server (probably you will need to install netcat: brew install netcat)

Negative coordinates

Hi,

recently I came across a very strange Barefoot response.

bfnegcoord

Black polyline at the left represents position samples and colored polyline is the matching response.
Route started at: 48,53449 -2,76065 and ended at: 48,47902 -2,62564. I noticed that route looks kind of mirrored, as if negative coordinates were reversed. I debugged whole communication from my client app to Barefoot and it looks like everything is passed in the right way, so I'm wondering if maybe it's a bug in the Barefoot itself? Have you ever tested it with negative coordinates?

Can not start test map server and the Tracker server in OSGeo-Live 10

Hello, I had build the barefoot on OSGeo-Live 10. I have try so much times to run the test map server and the Tracker server, however they could not start. Here is the error informations that the Tracker control can not start:

user@user-VirtualBox:~/barefoot$ java -jar target/barefoot-0.1.0-tracker-jar-with-dependencies.jar config/tracker.properties config/oberbayern.properties
2017-01-17 13:17:07,913 INFO [main] TrackerControl: initialize server
2017-01-17 13:17:07,922 INFO [main] TrackerControl: read database properties from file config/oberbayern.properties
2017-01-17 13:17:07,940 INFO [main] Loader: load map from database oberbayern
2017-01-17 13:17:07,942 INFO [main] Loader: open road reader for database oberbayern at localhost:5432
2017-01-17 13:17:07,945 INFO [main] Loader: database.host=localhost
2017-01-17 13:17:07,956 INFO [main] Loader: database.port=5432
2017-01-17 13:17:07,957 INFO [main] Loader: database.name=oberbayern
2017-01-17 13:17:07,957 INFO [main] Loader: database.table=bfmap_ways
2017-01-17 13:17:07,958 INFO [main] Loader: database.user=osmuser
2017-01-17 13:17:07,958 INFO [main] Loader: database.road-types=./map/tools/road-types.json
2017-01-17 13:17:08,073 INFO [main] PostGISReader: open reader (standard)
2017-01-17 13:17:08,081 INFO [main] PostGISReader: open reader (parameterized)
2017-01-17 13:17:08,328 ERROR [main] TrackerControl: Opening PostgreSQL connection failed: FATAL: role "osmuser" does not exist
2017-01-17 13:17:08,337 INFO [Thread-0] TrackerControl: stopping server
2017-01-17 13:17:08,338 ERROR [Thread-0] TrackerControl: stopping server failed, not yet started

Real-time matching imprecise

Hello,

We are trying to use online mapmatching, but unfortunately we see a lot of problems. If you look at the attached picture on the right you will see raw positions - driver went back and forth on the main road, but on the matched picture on the left there is a lot of strange movements. May be we are missing some settings? Have you seen such a behavior? Basically what happens if the speed slows down matcher starts making "loops" using nearby small roads.
Hope you can clear this mystery for us.

Thanks!

bf_problem

RoadMap reader crashes with Out of memory

Hello,

i just tried to use a bigger map - the whole Germany. Import procedure finishes succesfully, but when I start the server and it begins importing data from Postgres after about 5000000 ways it crashes with java.lang.OutOfmemoryError java heap space error.
I tried increasing memory size for the heap, but then it crashes with GC overhead limit exceeded.

have you tried working with bigger maps? any suggestions on how to solve this problem?

thanks!

2016-05-21 21:58:46,025 INFO  [main] RoadMap: inserted 5000000 (9292848) roads
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
        at java.lang.Class.getDeclaredFields0(Native Method)
        at java.lang.Class.privateGetDeclaredFields(Class.java:2583)
        at java.lang.Class.getDeclaredField(Class.java:2068)
        at java.util.concurrent.atomic.AtomicReferenceFieldUpdater$AtomicReferenceFieldUpdaterImpl$1.run(AtomicReferenceFieldUpdater.java:316)
        at java.util.concurrent.atomic.AtomicReferenceFieldUpdater$AtomicReferenceFieldUpdaterImpl$1.run(AtomicReferenceFieldUpdater.java:314)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.util.concurrent.atomic.AtomicReferenceFieldUpdater$AtomicReferenceFieldUpdaterImpl.<init>(AtomicReferenceFieldUpdater.java:313)
        at java.util.concurrent.atomic.AtomicReferenceFieldUpdater.newUpdater(AtomicReferenceFieldUpdater.java:109)
        at java.sql.SQLException.<clinit>(SQLException.java:372)
        at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1857)
        at org.postgresql.core.v3.QueryExecutorImpl.fetch(QueryExecutorImpl.java:2089)
        at org.postgresql.jdbc2.AbstractJdbc2ResultSet.next(AbstractJdbc2ResultSet.java:1916)
        at com.bmwcarit.barefoot.road.PostGISReader.next(PostGISReader.java:140)
        at com.bmwcarit.barefoot.roadmap.RoadMap.Load(RoadMap.java:140)
        at com.bmwcarit.barefoot.matcher.ServerControl.initServer(ServerControl.java:116)
        at com.bmwcarit.barefoot.matcher.ServerControl.main(ServerControl.java:245)
2016-05-21 23:40:49,980 INFO  [Thread-0] ServerControl: stopping server
2016-05-21 23:40:49,982 ERROR [Thread-0] ServerControl: stopping server failed, not yet started

Database update

Hi, I'm wondering if there is more clever way to update Barefoot's PSQL database other than simple dropping it and reimport all data again. I'd really appreciate every tip in that matter.

Thank you in advance

Filter: HMM break - no state transitions (empty result json)

Hi,

first of all, thank you very much for this great software package! It is very interessting for me to discover the software functionalty, I programmed a very similar algorithm (ST-Matching) during my Phd.

To the problem:
I would like to match a set of trajectories. A large number of the trajectories are not proccessed correctly, The following message occurs: HMM break - no state transition or emissions. I tried to investigate the reason for this problem, without success. Please find attatched the send message and the raw data.

traj.txt
rawTraj.txt

It would be fine, if anybody could help me.

With regards,
Steffen

Shortening road sequence

We are looking into using barefoot for our tracking system. As we have cars driving for a long time, the k-state vectors of the cars get quit huge ...

We now like to get the driven track of the car (i.e. matched points and driven segments) into a separate database and if done, delete this part in the k-state vector.

Have you done something like that or if not, how would you suggest to do it?

Matching algorithm tuning

Hi,

I've reviewed very many routes along with its matched versions and I noticed that sometimes Barefoot choose more important roads in matching, even if the position samples are rather obvious (like in the picture below). I think it may be related to object's speed which makes Barefoot 'think' that object is travelling on road with bigger max speed. Is there a way to handle that somehow? Like put more priority on geocoordinates than timestamps?

szybszadroga

Is Matcher threadsafe?

Hey,

I am running some processing in separate threads to speed things up, I'm wondering if Map and/or Matcher objects are threadsafe. I am sharing a Matcher object between threads but I am not quite sure if it is all right. If it's not safe I could pass in a map and instantiate separate matchers, but then again, I'd have to be sure Map is threadsafe.

Thanks

Tunnel recognition

Hi @smattheis,

I'm looking for an improvement in the algorithm regarding the recognition of tunnels.

My concern is, that I have several tracks, where a tunnel has nearly the same geometry as a surface road. In these situations the matching is often wrong and leeds to really ugly routings:

image

Shown in green is the correct way through the tunnel and red is the surface routing, which BF prefers ...

Now I have to make two changes:

  1. Extend the road class with a tunnel flag and fill it from the original map
  2. Extend the calculation of emission probabilities

First point is trival, but the second is puzzling me.
A simple assumption is, that if I have a GPS measurement the tracker cannot be in a tunnel. But this of course is to simple as the tunnel can be very short or the ramps down in and up from the tunnel are modelled as tunnel, but has still have good satellite signal.

I have made some promissing experiments in changing the minimize function of road point candidates or in decreasing the emission propability of road points.
But overall I'm unsure about a robust solution ...

Have you thought about this or have you ad hoc any good ideas on a solution for this?

BR
Volker

Pedestrian and Bicycle matching

Hello,
I'm working on a project which tracks users on foot and on bicycle.
Barefoot seems to be only able to match on motor vehicles (which makes sense given the name of the copywrite holder).
I was curious if it would be difficult to add these capabilities to Barefoot. I noticed there is a bfmap/road-types.json file which I assume states the road types to get from OSM. I tried adding the footway, cycleway and path tags, but the final result was the same (only slower).

Thanks for taking the time to read. I'm not sure if this constitutes as an issue, but any information you can provide would be much appreciated.

Cheers,
Filipe

Unwanted road types when using import.sh

Hi

I have been using the import script and the default road-types.json file to produce my map server, but my matching results are including roads that should be excluded by the import script(s). In particular, when I import the geofabrik extract for all Australia using the script and match my GPS traces I get "construction", "footway", "proposed", "rest-area" and "track" amongst the results (including the imputed routes).

For instance, there is a section of highway being constructed to bypass the towns of Nambucca Heads and Macksville here. I have a small number of observations that are matched to where the old and proposed roads meet, which is sensical. But when a vehicle has passed from south of the in construction bypass to the north without pinging, the algorithm logically expects they have taken the direct route, and so this segment is attributed to a great many vehicle journeys (parts of my data are relatively low resolution).

But the road should be available for matching at all. The "highway" tag clearly says "construction" and is not included in road-types.json. I tried adding "construction" (and the others) to road-types with arbitrarily priorities (99) and zero speed to try and dissuade any matches, but to no avail.

This isn't a major problem, since the majority of my data is of sufficient resolution that the actual route is matched most of the time (and I am mainly concerned about the underlying roads and can safely ignore ones that don't exist yet), but it is bemusing.

Thank you once again

mvn package error on matching server

Hi! I just started using barefoot for some map matching needs. I'm following the excellent documentation you guys wrote with it.

I'm trying to start a local matching server by following these instructions. Now I'm already on the mvn package step, and for some reason the build is failing. I tried to skip tests with the DskipTests but the build still fails.

Here's the stack trace when I ran mvn package -Dskiptests -e:

[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building barefoot 0.1.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ barefoot ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ barefoot ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 78 source files to /Users/adler/swat/barefoot/target/classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ barefoot ---
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO] Copying 6 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ barefoot ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ barefoot ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ barefoot ---
Downloading: https://repo.maven.apache.org/maven2/commons-lang/commons-lang/2.1/commons-lang-2.1.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.490 s
[INFO] Finished at: 2017-02-08T18:54:43+08:00
[INFO] Final Memory: 18M/174M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:2.4:jar (default-jar) on project barefoot: Execution default-jar of goal org.apache.maven.plugins:maven-jar-plugin:2.4:jar failed: Plugin org.apache.maven.plugins:maven-jar-plugin:2.4 or one of its dependencies could not be resolved: Failed to collect dependencies at org.apache.maven.plugins:maven-jar-plugin:jar:2.4 -> commons-lang:commons-lang:jar:2.1: Failed to read artifact descriptor for commons-lang:commons-lang:jar:2.1: Could not transfer artifact commons-lang:commons-lang:pom:2.1 from/to central (https://repo.maven.apache.org/maven2): repo.maven.apache.org: nodename nor servname provided, or not known: Unknown host repo.maven.apache.org: nodename nor servname provided, or not known -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:2.4:jar (default-jar) on project barefoot: Execution default-jar of goal org.apache.maven.plugins:maven-jar-plugin:2.4:jar failed: Plugin org.apache.maven.plugins:maven-jar-plugin:2.4 or one of its dependencies could not be resolved: Failed to collect dependencies at org.apache.maven.plugins:maven-jar-plugin:jar:2.4 -> commons-lang:commons-lang:jar:2.1
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
	at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-jar of goal org.apache.maven.plugins:maven-jar-plugin:2.4:jar failed: Plugin org.apache.maven.plugins:maven-jar-plugin:2.4 or one of its dependencies could not be resolved: Failed to collect dependencies at org.apache.maven.plugins:maven-jar-plugin:jar:2.4 -> commons-lang:commons-lang:jar:2.1
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:106)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
	... 20 more
Caused by: org.apache.maven.plugin.PluginResolutionException: Plugin org.apache.maven.plugins:maven-jar-plugin:2.4 or one of its dependencies could not be resolved: Failed to collect dependencies at org.apache.maven.plugins:maven-jar-plugin:jar:2.4 -> commons-lang:commons-lang:jar:2.1
	at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolveInternal(DefaultPluginDependenciesResolver.java:214)
	at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve(DefaultPluginDependenciesResolver.java:149)
	at org.apache.maven.plugin.internal.DefaultMavenPluginManager.createPluginRealm(DefaultMavenPluginManager.java:400)
	at org.apache.maven.plugin.internal.DefaultMavenPluginManager.setupPluginRealm(DefaultMavenPluginManager.java:372)
	at org.apache.maven.plugin.DefaultBuildPluginManager.getPluginRealm(DefaultBuildPluginManager.java:231)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:102)
	... 21 more
Caused by: org.eclipse.aether.collection.DependencyCollectionException: Failed to collect dependencies at org.apache.maven.plugins:maven-jar-plugin:jar:2.4 -> commons-lang:commons-lang:jar:2.1
	at org.eclipse.aether.internal.impl.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:291)
	at org.eclipse.aether.internal.impl.DefaultRepositorySystem.collectDependencies(DefaultRepositorySystem.java:316)
	at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolveInternal(DefaultPluginDependenciesResolver.java:202)
	... 26 more
Caused by: org.eclipse.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for commons-lang:commons-lang:jar:2.1
	at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:282)
	at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:198)
	at org.eclipse.aether.internal.impl.DefaultDependencyCollector.resolveCachedArtifactDescriptor(DefaultDependencyCollector.java:535)
	at org.eclipse.aether.internal.impl.DefaultDependencyCollector.getArtifactDescriptorResult(DefaultDependencyCollector.java:519)
	at org.eclipse.aether.internal.impl.DefaultDependencyCollector.processDependency(DefaultDependencyCollector.java:409)
	at org.eclipse.aether.internal.impl.DefaultDependencyCollector.processDependency(DefaultDependencyCollector.java:363)
	at org.eclipse.aether.internal.impl.DefaultDependencyCollector.process(DefaultDependencyCollector.java:351)
	at org.eclipse.aether.internal.impl.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:254)
	... 28 more
Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Could not transfer artifact commons-lang:commons-lang:pom:2.1 from/to central (https://repo.maven.apache.org/maven2): repo.maven.apache.org: nodename nor servname provided, or not known
	at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:444)
	at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:246)
	at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:223)
	at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:267)
	... 35 more
Caused by: org.eclipse.aether.transfer.ArtifactTransferException: Could not transfer artifact commons-lang:commons-lang:pom:2.1 from/to central (https://repo.maven.apache.org/maven2): repo.maven.apache.org: nodename nor servname provided, or not known
	at org.eclipse.aether.connector.basic.ArtifactTransportListener.transferFailed(ArtifactTransportListener.java:43)
	at org.eclipse.aether.connector.basic.BasicRepositoryConnector$TaskRunner.run(BasicRepositoryConnector.java:355)
	at org.eclipse.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:67)
	at org.eclipse.aether.connector.basic.BasicRepositoryConnector$DirectExecutor.execute(BasicRepositoryConnector.java:581)
	at org.eclipse.aether.connector.basic.BasicRepositoryConnector.get(BasicRepositoryConnector.java:249)
	at org.eclipse.aether.internal.impl.DefaultArtifactResolver.performDownloads(DefaultArtifactResolver.java:520)
	at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:421)
	... 38 more
Caused by: org.apache.maven.wagon.TransferFailedException: repo.maven.apache.org: nodename nor servname provided, or not known
	at org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.fillInputData(AbstractHttpClientWagon.java:1066)
	at org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.fillInputData(AbstractHttpClientWagon.java:960)
	at org.apache.maven.wagon.StreamWagon.getInputStream(StreamWagon.java:116)
	at org.apache.maven.wagon.StreamWagon.getIfNewer(StreamWagon.java:88)
	at org.apache.maven.wagon.StreamWagon.get(StreamWagon.java:61)
	at org.eclipse.aether.transport.wagon.WagonTransporter$GetTaskRunner.run(WagonTransporter.java:560)
	at org.eclipse.aether.transport.wagon.WagonTransporter.execute(WagonTransporter.java:427)
	at org.eclipse.aether.transport.wagon.WagonTransporter.get(WagonTransporter.java:404)
	at org.eclipse.aether.connector.basic.BasicRepositoryConnector$GetTaskRunner.runTask(BasicRepositoryConnector.java:447)
	at org.eclipse.aether.connector.basic.BasicRepositoryConnector$TaskRunner.run(BasicRepositoryConnector.java:350)
	... 43 more
Caused by: java.net.UnknownHostException: repo.maven.apache.org: nodename nor servname provided, or not known
	at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
	at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:928)
	at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1323)
	at java.net.InetAddress.getAllByName0(InetAddress.java:1276)
	at java.net.InetAddress.getAllByName(InetAddress.java:1192)
	at java.net.InetAddress.getAllByName(InetAddress.java:1126)
	at org.apache.maven.wagon.providers.http.httpclient.impl.conn.SystemDefaultDnsResolver.resolve(SystemDefaultDnsResolver.java:44)
	at org.apache.maven.wagon.providers.http.httpclient.impl.conn.HttpClientConnectionOperator.connect(HttpClientConnectionOperator.java:101)
	at org.apache.maven.wagon.providers.http.httpclient.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:318)
	at org.apache.maven.wagon.providers.http.httpclient.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:363)
	at org.apache.maven.wagon.providers.http.httpclient.impl.execchain.MainClientExec.execute(MainClientExec.java:219)
	at org.apache.maven.wagon.providers.http.httpclient.impl.execchain.ProtocolExec.execute(ProtocolExec.java:195)
	at org.apache.maven.wagon.providers.http.httpclient.impl.execchain.RetryExec.execute(RetryExec.java:86)
	at org.apache.maven.wagon.providers.http.httpclient.impl.execchain.RedirectExec.execute(RedirectExec.java:108)
	at org.apache.maven.wagon.providers.http.httpclient.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
	at org.apache.maven.wagon.providers.http.httpclient.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
	at org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.execute(AbstractHttpClientWagon.java:832)
	at org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.fillInputData(AbstractHttpClientWagon.java:983)
	... 52 more
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException

Hope you can help. Thank you.

Unable to start matcher server in quickstart guideline - postgres related

Hi

I am following the quickstart guideline here to the letter, except for the container creation step where I stipulate -p 5432 instead of 5432:5432 which produced a conflict - however I don't believe this is causing the error.

When I try to start the server I receive the output posted below reporting that .""bfmap_ways" does not exist" This is distinct to the problem here as the table name and config file are aligned. If I attach the container I can see the server is working, and with psql \oberbayern \d I can see that the "bfmap_ways" table is indeed there. It does not appear to be having problems connecting to the server.

I am using Debian stretch, PostgreSql 9.6.1 and docker 1.13.0.

Thankyou

root@<my_computer>:/home//barefoot# java -jar target/barefoot-0.1.0-matcher-jar-with-dependencies.jar --geojson config/server.properties config/oberbayern.properties
2017-02-01 16:56:46,468 INFO [main] ServerControl: initialize server
2017-02-01 16:56:46,472 INFO [main] ServerControl: read database properties from file config/oberbayern.properties
2017-02-01 16:56:46,474 INFO [main] Loader: load map from database oberbayern
2017-02-01 16:56:46,474 INFO [main] Loader: open road reader for database oberbayern at localhost:5432
2017-02-01 16:56:46,475 INFO [main] Loader: database.host=localhost
2017-02-01 16:56:46,475 INFO [main] Loader: database.port=5432
2017-02-01 16:56:46,475 INFO [main] Loader: database.name=oberbayern
2017-02-01 16:56:46,475 INFO [main] Loader: database.table=bfmap_ways
2017-02-01 16:56:46,475 INFO [main] Loader: database.user=osmuser
2017-02-01 16:56:46,475 INFO [main] Loader: database.road-types=./map/tools/road-types.json
2017-02-01 16:56:46,511 INFO [main] PostGISReader: open reader (standard)
2017-02-01 16:56:46,511 INFO [main] PostGISReader: open reader (parameterized)
2017-02-01 16:56:46,578 INFO [main] RoadMap: inserting roads ...
2017-02-01 16:56:46,578 INFO [main] PostGISReader: execute query
2017-02-01 16:56:46,607 ERROR [main] ServerControl: Executing PostgreSQL query failed: ERROR: relation "bfmap_ways" does not exist
Position: 133
2017-02-01 16:56:46,612 INFO [Thread-0] ServerControl: stopping server
2017-02-01 16:56:46,613 ERROR [Thread-0] ServerControl: stopping server failed, not yet started

HMM break - no state emissions

Hello!
As part of my PhD, I'm evaluating the performance of several map matching techniques, under different conditions. I think your implementation of HMM is worth testing, thank you for this great contribution!

However I'm still getting some problems with the online matching, when trying to use the server. I've set up a traffic simulator which is generating coordinate pairs each second and sending them in json format (attached). At this stage output is always already matched, due to the simulation. input_json_barefoot.txt

Network data was extracted to postgis from https://download.geofabrik.de/europe/andorra-latest.osm.pbf, and created the bfmapways table as stated in your manual.

I always get the HMM break - no state emissions message, but the network seems complete, and the route follows known links at all times. Any hints? Many thanks in advance.

These are the input data (bfmapways and original GPX file from the simulation output).
simulation_output_andorra

Question: output format of online Tracker Server

Thank you so much for your great contribution. As the Wiki said, After the success of Tracker server, the track can be visualized on http://localhost:3000. It's very easy for us to know whether the map matching result is right by visualizing in the map. However, if the time interval becomes bigger, for example each 45s to get a GPS point, I can just know the map matching of each point, not the whole trajectory, because I can just see the red pot in the map, and I have no idea which route the point has gone through, and the respond time for the online map matching algorithm to match a GPS point in each 45s. So I am just curious about whether I can get the whole output result in a file, include respond time, the online map matching result and the routing between each two results, for example in a JSON file.

Download osm

I am following the tutorial but I am not able to download the osm data. Can anyone give me some advice, thanks.

Help w Spark?

Hi there - I have the test working w the docker container and the java server/python script. My next test is to get it working w spark. Do you have a working example of BroadcastMatcher.scala (I'm trying to get things to work w your sample scala code block but I think I need to import a few classes and I want to make sure I'm referencing the right configfile etc). It looks like the broadcast is pointing to the postGIS db to pull the osm data to each node in my spark cluster?

Thanks for any help/advice. Great project!

Road ID

Hello,

the installation and usage of Barefoot just worked fine. The matching already works and I got some good results.

Now I would like to get additional information about the matched roads. Barefoot returns data like this (slimjson mode) :

... {
"route": "LINESTRING (106.89085170694243 -6.142643394836986, 106.89085170694243 -6.142643394836986)",
"road": 1199220,
"frac": 0.7514822019311651
} ...
I would like to request information like speed level or road type. How can I retrieve this kind of information. Is there a way to query for example Nominatim?

What kind of Road ID is the returned one?

Thank you!

BR, Jan

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.