cyang-kth / fmm

Fast map matching, an open source framework in C++
https://fmm-wiki.github.io/
Apache License 2.0
884 stars 211 forks source link

Help for improving map matching result #132

Closed thegreathir closed 3 years ago

thegreathir commented 3 years ago

Hi, Thank you for your nice and awesome project. I'm trying to match some GPS location track to OpenStreetMap using fmm and your guides. As you can see in the picture there is some redundant turn around the square here. I want to drop it but I don't know how to tune the parameter to achieve this. mm

parameters:

K = 8
RADIUS = 0.003
GPS_ERROR = 0.0005
VMAX = 0.0003
FACTOR = 1.5
cyang-kth commented 3 years ago

@thegreathir

In your case, you can try to increase k, radius and GPS error to check if that turning around behavior can be removed.

thegreathir commented 3 years ago

@cyang-kth Thank you for your quick response! I tried but no chance... Is this turning around behavior expected? As you know black dots are raw data, I mean can you guess why this is happening?

cyang-kth commented 3 years ago

@thegreathir

It depends on the topology of the road network. From the GPS observations, I do not think it is reasonable to have this match result.

thegreathir commented 3 years ago

Ok thanks. I could not fix it with changing parameters but I think we can close the issue

cyang-kth commented 3 years ago

@thegreathir If you can send me this specific trajectory in a WKT file. Then perhaps I could test it on my side, assuming that you are also using OSM road network. I am quite busy recently so I may be able to look at it later.

iamiranjbar commented 3 years ago

Hi @cyang-kth, Thanks for your awesome map matcher. I'm @thegreathir teammate. I'll send you above trajectory line in below part. 'LineString(51.415418 35.70142,51.415671 35.70139,51.417409 35.70143,51.41869 35.701547,51.418691 35.701542,51.418787 35.701359,51.418999 35.701279,51.419235 35.701339,51.419358 35.701538,51.419358 35.70155,51.420176 35.70148,51.420254 35.701482,51.424006 35.701563)' We will be very thankful for your help and time to test this case as soon as possible. <3

cyang-kth commented 3 years ago

@iamiranjbar @thegreathir

On my side, it works normally (the orange line below).

image

Which version are you using? Is it the latest one?

thegreathir commented 3 years ago

@cyang-kth yes we are using python wrapper from last github version. Is it STMATCH? How much are VMAX and Factor?

cyang-kth commented 3 years ago

I set vmax to 30/1.1e5 and factor to 1.5.

thegreathir commented 3 years ago

@cyang-kth Can you please send the one line command? I think our parameter is approximately same

cyang-kth commented 3 years ago

I tried with this command:

stmatch --network edges.shp --network_id fid --source u --target v \
--gps traj.csv -k 8 -r 0.003 -e 0.0005 --output mr.txt --output_fields opath,cpath,mgeom

The output looks like

id;opath;cpath;mgeom
1;280,280,434,442,344,344,344,344,1362,1362,840,840,952;280,460,434,442,344,1362,840,952;LINESTRING(51.4154186119 35.7013897351,51.4158917 35.7013993,51.4161744 35.701405,51.4169395 35.7014206,51.4175189 35.7014324,51.418261 35.7014459,51.4183935 35.7014502,51.4186387 35.701375,51.4186542 35.7013608,51.4186708 35.7013468,51.4186892 35.7013326,51.4187082 35.7013186,51.418726 35.7013075,51.4187441 35.7012966,51.4187645 35.7012876,51.4187853 35.7012789,51.4188066 35.7012732,51.4188278 35.701268,51.4188741 35.7012574,51.4189248 35.7012482,51.4189872 35.7012406,51.4190466 35.7012363,51.4190768 35.7012345,51.4191069 35.7012329,51.4191648 35.7012329,51.4191873 35.7012338,51.4192002 35.7012343,51.4192194 35.7012355,51.4192407 35.7012379,51.4192606 35.7012408,51.419306 35.7012524,51.4193529 35.7012692,51.4193922 35.7012855,51.419424 35.701301,51.4194457 35.7013139,51.4194679 35.701327,51.4194905 35.7013436,51.4195126 35.7013594,51.4196701 35.7014354,51.4198029 35.7014648,51.4199933 35.7014768,51.4216071 35.7015147,51.424005823 35.7015705965)
thegreathir commented 3 years ago

I'm really sorry, I thought our map is OpenStreetMap but it is not. It has some small difference. I tested it on OpenStreetMap and result was as same as you. Could you please take a look at this graph? Thank you very much for your attention...

cyang-kth commented 3 years ago

@thegreathir

I think the problem you encountered is a special case of outlier in FMM. After updating the transition probability calculation at here, the problem is fixed at #131.

image

Just pull the latest version of fmm and run

stmatch --network edges.shp --network_id fid --source u --target v --gps traj.csv -k 16 -r 0.01 -e 0.01 \
--output mr.txt --output_fields opath,cpath,mgeom

Some other parameters of k,r,e should also work.

thegreathir commented 3 years ago

@cyang-kth It's fixed Thank you a lot for your great support and amazing matching library