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

Problem matching bus/footwalk/bicycle traces #74

Closed aggour211 closed 6 years ago

aggour211 commented 6 years ago

Hello there,

We have used Barefoot server on a Docker and it could help me a lot in my academic project. It works fine, except that we seem to have 2 main issues:

Here are the two maps, one from GPS, and the other from the result of Barefoot.

Our objectif is to cross the Map-Matching Barefoot data result to the OpenStreetMap data to get information of the road such as its address, and ig there is a red light, etc.

As you can see from the raw data of GPS and MapMatcher result, there are latitudes and longitudes which are very precise in the digits (ex: 42.78623487523) and we do not find back the data from OpenStreetMap, in order to cross both data sources.

Can you help us understand what is wrong ? NOTE: We have been using the default server config.

Best regards,

Issam Aggour

example example_mapmatched

After_Mapmatching.txt Raw_Data.txt

smattheis commented 6 years ago

Could you please provide the input data in the format that you used to produce the matching result? Thanks.

aggour211 commented 6 years ago

Thank you for you quick answer !

Here is the json file we used as input in this case: http://uptobox.com/ufl2wnbe90nz

Best regards, Issam

smattheis commented 6 years ago

It seems that your trace is recorded from a trip by foot or bicycle and the route violates one-way rules that hold for motorized vehicles. Since the matcher/router doesn't know that, it forces the search for legal routes and, hence, provides respective detours.

A quick fix could be to rewrite one-way information in the database, e.g., with:

sudo docker exec <container> psql -h localhost -U osmuser -d <database> -c "create table bfmap_ways_foot as table bfmap_ways;"
sudo docker exec <container> psql -h localhost -U osmuser -d <database> -c "update bfmap_ways_foot set reverse=1;"

After that, set the table in database.properties to use the new footwalk map data:

database.table=bfmap_ways_foot

Note: Don't forget to delete the .bfmap file, because it holds the map for motorized vehicles!

After that I get the following result with matcher.sigma=15 and matcher.distance.min=5:

barefoot_ile-de-france_footpath

The little detours are from position measurement errors (probably you walked diagonal to the roads across a place or so). I think the matcher can't help here because it's too ambiguous.

aggour211 commented 6 years ago

Thank you very much for the explanation and fix. But it was not a bicycle, but a bus trip. The bus was going in the opposite direction on a one-way road, as expected by OpenStreetMap data. As you can see on the OpenStreetMap screenshot, for this road, "busway=opposite_lane". screen shot 2017-10-01 at 13 01 48

smattheis commented 6 years ago

I see, to fix such specific roads you can correct the particular road in the database respectively:

sudo docker exec <container> psql -h localhost -U osmuser -d <database> -c "update bfmap_ways_foot set reverse=1 where osm_id=<osm-id>;"