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 #136

Closed iamiranjbar closed 3 years ago

iamiranjbar commented 3 years ago

Hello @cyang-kth Sorry we contact you again. We continued with the last version of code and saw another unusual result: gg Red is GPS track and blue is STMatch result. Here is parameters: K = 32 RADIUS = 0.003 GPS_ERROR = 0.0005 VMAX = 0.0003 FACTOR = 1.5 We use base map that is a little different from osm. You can find it in below link. base map: https://drive.google.com/file/d/1sobd93y9IFWi5S9ju1aI39dD6o92_z9j/view?usp=sharing Here is the GPS track linestring:

LineString(51.492048 35.786242,51.492065999999994 35.786386,51.492076000000004 35.78653,51.492077 35.786674,51.492144 35.7869,51.492156 35.786971,51.492160999999996 35.787024,51.492162 35.787084,51.492158 35.787146,51.492151 35.78719,51.492141 35.787243,51.492132 35.787293,51.49212 35.787354,51.492102 35.787428000000006,51.492086 35.787490000000005,51.492065000000004 35.787563,51.492041 35.787638,51.492020000000004 35.787698,51.491962 35.787848,51.491826 35.788105,51.491702000000004 35.788365,51.49159 35.788629,51.491557 35.788711,51.491525 35.788794,51.491495 35.788877,51.491459000000006 35.788983,51.491426000000004 35.789089000000004,51.491397 35.789195,51.491356 35.789371,51.491323 35.789549,51.491298 35.789727,51.491288 35.789781,51.491282 35.789809999999996,51.491276 35.789838,51.49127 35.789868,51.491256 35.78993,51.491248999999996 35.789959,51.491240000000005 35.789984999999994,51.49123 35.790013,51.491219 35.790043,51.491207 35.790079,51.491196 35.790109,51.49119 35.790127000000005,51.491172999999996 35.790174,51.491181 35.79031,51.491196 35.790445,51.491217 35.790579,51.491248999999996 35.790729999999996,51.49129 35.79088,51.491337 35.791028000000004,51.491398 35.791196,51.491467 35.791361,51.491544 35.791525,51.491614 35.79166,51.491689 35.791793,51.491771 35.791924,51.491779 35.791936,51.491786 35.791946,51.491791 35.791956,51.491797999999996 35.791965999999995,51.491803000000004 35.791975,51.49181 35.791984,51.491817 35.791996000000005,51.491825 35.792006,51.491904999999996 35.792122,51.491972 35.792221999999995,51.492019 35.7923,51.492063 35.792379,51.492105 35.79246,51.49217 35.792607000000004,51.492225 35.792758,51.492274 35.79291,51.492315000000005 35.793056,51.492351 35.793202,51.492384 35.79335,51.49245 35.793707,51.492501000000004 35.794066,51.492563 35.794424,51.492598 35.794584,51.492635 35.794745,51.492674 35.794905,51.492751 35.795101,51.492839000000004 35.795294,51.492934999999996 35.795483000000004,51.49305 35.795682,51.493169 35.79588,51.49328 35.796081,51.493377 35.79629,51.493459 35.796504,51.493527 35.796721000000005,51.493581 35.796987,51.493615999999996 35.797256,51.493666 35.797523,51.493702 35.797652,51.493742 35.797779999999996,51.493784000000005 35.797907,51.493825 35.79802,51.493868 35.798132,51.493913 35.798244,51.493914000000004 35.798245,51.493914000000004 35.798245,51.493914000000004 35.798245,51.493914000000004 35.798245,51.493914000000004 35.798244,51.493914000000004 35.798244,51.493914000000004 35.798242,51.493913 35.798241,51.493913 35.79824,51.493913 35.798238,51.493912 35.798237,51.493912 35.798235999999996,51.493912 35.798235,51.493912 35.798234,51.493912 35.798234,51.493912 35.798234,51.493912 35.798234,51.493913 35.798235,51.493913 35.798235999999996,51.493914000000004 35.798238,51.493915 35.798241,51.493916999999996 35.798244,51.493919 35.798248,51.493921 35.798253,51.493922999999995 35.79826,51.493926 35.798266999999996,51.493929 35.798275,51.493932 35.798284,51.493936 35.798294,51.49394 35.798306,51.493945000000004 35.798319,51.49395 35.798333,51.493986 35.798435,51.494025 35.798528999999995,51.494065 35.798617,51.494108000000004 35.798698,51.494153999999995 35.798774,51.494202 35.798844,51.494252 35.79891,51.494305 35.798972,51.494359 35.799029,51.494415999999994 35.799084,51.494475 35.799135,51.494537 35.799184000000004,51.4946 35.799231,51.494765 35.799307,51.494956 35.799392,51.495169 35.799479999999996,51.495402 35.799562,51.495653999999995 35.79963,51.49592 35.799676,51.496025 35.799690999999996,51.496195 35.799704,51.496368 35.799701,51.496475 35.799699,51.496505 35.799696000000004,51.496618 35.799684,51.496771 35.799665000000005,51.497232000000004 35.799575,51.498043 35.799401,51.499728999999995 35.799054999999996,51.500465999999996 35.798918,51.500483 35.798915,51.501284000000005 35.798737,51.501514 35.798686,51.501732000000004 35.798638000000004,51.501789 35.798626,51.502116 35.798553000000005,51.502501 35.798468,51.503261 35.798301,51.506296999999996 35.797647,51.506757 35.797540999999995,51.507028999999996 35.797496,51.507439 35.797449,51.50777 35.797381,51.508589 35.797222999999995)

We play with parameters a lot but can't get good result. Can you help us again?

cyang-kth commented 3 years ago

@iamiranjbar The problem is that your data contains reverse movement, as shown below.

FMM assume the object always move along the direction of an edge so that it cannot turn back. This issue has been reported previously. #98

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

image

You can set the parameter reverse_tolerance to correct this problem (which set the proportion of reverse movement on an edge)

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

image

The current code contains this parameter but it is not printed for stmatch. I have updated the code in the master branch to print that parameter for stmatch.

iamiranjbar commented 3 years ago

Thanks a lot for your response. You helped us very much and i really appreciate you. @cyang-kth