Skip to content
Snippets Groups Projects
Commit b4297eda authored by Ting Gao's avatar Ting Gao
Browse files

upload codes

parent 3411b8e0
No related branches found
No related tags found
No related merge requests found
Showing
with 27530 additions and 2 deletions
.DS_Store 0 → 100644
File added
# mm4b
Welcome to the map-matching package tailored for bicycles! The paper can be found here: https://doi.org/10.1049/itr2.12567.
## Preparatory work
1. Create a folder graph/raw/ to store raw road network information
2. Create mapMatch_result/ to store the processed road network
3. Create mapMatch_result/ptsDf_/ to store the selected road candidates (within 50m)
4. Create mapMatch_result/rlt_/viterbi/ to store the map-matched result
5. Put the OpenStreetMap shapefile in the raw_map folder
6. Put the raw GPS data as data/stepII.h5, csv form as data/stepII.csv. Columns:tripID;timestamp;lat;lon.
## To be updated
## Run steps
1. In local computer, run step1_simplify_graph.py and step2_main_road_evaluation.py
2. Sbatch step3_supercomputer_run.sh on supercomputer or run parallel_run.py with function_name=getsPts in server
3. Sbatch step4_supercomputer_run.sh on supercomputer or run parallel_run.py with function_name=matchTrace in server
This repository will be updated soon.
\ No newline at end of file
## Output format
Output results are in mapMatch_result/rlt_/viterbi/, format:
tripID: identity of each trip trajectory to be mapped
nid: recorded order of GPS point
edge: mapped road segment ID in the compact graph (section 3.2)
full_edge: mapped road segment ID in the raw graph
dist: distance (m) between GPS point and the mapped road
frcalong: travelled ratio over this edge
secs: time difference (s) from 2020-10-01
seglength: travelled distance (km) over this edge
## Acknowledgement
Part of code in this repository is derived from "https://github.com/amillb/pgMapMatch".
\ No newline at end of file
File added
File added
# how many nodes pgrouting can route at once.
# If you have lots of memory, increase. If you get a memory error, reduce
maxNodes = 250
# All these parameters assume meters, but must match the units of your projection
# State Plane meters will normally work best
weight_1stlast = 1 # for the first and last node, how much distance weight is increased by. This helps to ensure the match is closer to and from the start and endpoint
gpsError = 50 # max distance that streets can be from GPS point to be considered
gpsError_fway = 70 # same, but for freeway (kmh>100) - because these roads are much wider
maxSpeed = 120 # speed threshold for deleting pings (kmh) in traceCleaner
# primary_punish = 1000
# secondary_punish = 0.5
# secondary_link_punish = 0.5
# tertiary_punish = 0.5
dist_threshold = 20
sigma_z = 4#10.0 # std dev parameter for geometric likelihood. Relates to GPS noise. Newson and Kummel 2009 say 4.0
sigma_t = 4 #0.3 # std dev parameter for temporal likelihood
sigma_topol = 0.6 #0.6 # std dev parameter for topological likelihood
temporal_scale = 1 #0.55 # scale parameter for temporal likelihood
temporal_weight = 1 # how more more the temporal likelihood is weighted relative to the distance likelihood score
topol_weight = 1 # how more more the topological likelihood is weighted relative to the distance likelihood score
skip_penalty = 5 # penalty for skipping a point is temporalLL(skip_penalty)
max_skip = 2 # maximum number of points to skip. Reducing this will improve performance
# uturnCost = 10 # if None, use the default (the average of the median cost and reverse cost in the edges)
allowFinalUturn = True # if True, allow a U-turn on the final edge
# column identifiers for the PostGIS table of streets
# the default values here are compatible with osm2po
streetIdCol = 'id' # unique id for street edge (i.e. segment or block)
streetGeomCol = 'geom_way' # geometry column (LineString) for street edge
startNodeCol = 'source' # id of node at which the street edge starts
endNodeCol = 'target' # id of node at which the street edge ends
travelCostCol = 'cost' # generalized cost to go from startNode to endNode
travelCostReverseCol = 'reverse_cost' # generalized cost to go from endNode to startNode. Can be same as travelCostCol if you have no one-way streets
streetLengthCol = 'km' # length of street, in km
speedLimitCol = 'kmh' # speed limit on street, in km per hour
# SQL-compliant query that identifies freeways (with the higher gps error tolerance)
fwayQuery = 'clazz<15 OR kmh>=100'
# comma-separated list of columns that are needed in fwayQuery, but are not listed above
fwayCols = 'clazz'
### Input files and save paths
raw_osm_file = "raw_map/rotterdam_citycenter"
point_save_path = "graph/raw/" #intermediate output storing point and linestring dictionary
complete_graph_path = "mapMatch_result/full_roads.shp"
simplified_graph_path = "mapMatch_result/coarse_roads.csv"
confirmed_coarse_path = "mapMatch_result/penalized_coarse_roads.csv" #file path storing all roads including confirmed main car roads
confirmed_roads_txt = "mapMatch_result/penalty_roads.txt"
confirmed_roads_html = "visualization/map_match/penalty_roads.html"
### Define coefficients for cost function
revser_coeffi = 0.2
alpha_coefficient = 1
beta_coefficient = 1
extra_mapped_penalty =5*alpha_coefficient # penalty for main car roads with low availability
alpha0, alpha1, alpha2, alpha3, alpha4 = 0, round(1*alpha_coefficient, 1), round(2*alpha_coefficient,1), round(3*alpha_coefficient, 1), round(extra_mapped_penalty, 1)
beta0, beta1, beta2, beta3, beta4 = 0, round(0.1*beta_coefficient,2), round(0.2*beta_coefficient,2), round(0.3*beta_coefficient,2), round(0.5*beta_coefficient, 2)
suspicious_penalty_ratio = 0.2
mapped_suspicious_penality = 5
### A rough classification of availability based on road type
class0 = ["cycleway"]
class1 = ["residential", "tertiary" ]
class2 = ["service", "path", "living_street"]
class3 = ["secondary","footway", "unclassified", "services", "pedestrian", "steps", "bridleway", "busway", "platform", "construction"]
class4 = ['primary', 'primary_link', 'secondary_link', 'motorway', 'motorway_link']
### Bikeable and unbikeable road types based on disrepancy between OSM and real-world observation
unconfirmed_roads_type = ["secondary", "tertiary"]
confirmed_car_roads_type=["primary", "primary_link", "secondary_link", "motorway", "motorway_link"]
bikable_type = ["cycleway", "footway", "residential"]
unbikeable_type = ["primary", "primary_link","tertiary", "secondary", "secondary_link", "motorway", "motorway_link"]
max_km_coefficient = 2 # searching distance expanding threshold for each road type
max_depth = 5 # searching depth threshold
### Rules
case1_theta = 1.2 # detour ratio threshold in case 1
case2_theta = 2 # detour ratio threshold in case 2
case3_delta = 0.02 # detour distance threshold in case 2, in km
frontier_exception_nodes = [19466] #Nodes that are in the frontier of network and do not contain alternative bikeable roads nearby
### Hyperparameters for the special case(a)
ver_invser_km_dict = {i:0.3 for i in unbikeable_type}
ver_invser_km_dict["tertiary"]=0.2
### Hyperparameters for the special case(b)
network_interrupt_threshold = 3
\ No newline at end of file
This diff is collapsed.
File added
File added
File added
File added
This diff is collapsed.
ISO-8859-1
\ No newline at end of file
File added
GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]
\ No newline at end of file
File added
File added
This diff is collapsed.
30,31,32,33,124,126,282,283,284,285,286,287,288,289,294,374,376,407,408,409,410,411,412,414,415,416,417,419,420,421,422,483,486,487,489,491,493,494,495,496,497,499,500,501,502,503,504,506,507,509,510,512,513,515,517,518,519,521,522,523,524,525,526,721,722,723,724,727,728,729,730,733,741,744,745,746,747,748,749,750,752,754,756,759,760,761,762,764,765,766,767,768,905,909,910,913,914,915,916,917,918,919,930,1188,1189,1263,1264,1265,1266,1267,1451,1452,1453,1698,1750,1751,1752,1753,1754,1758,1759,1767,1768,1769,1770,1771,1772,1773,1774,1775,1776,1778,1781,1782,1783,1785,1789,1790,1791,1793,1795,1796,1797,1799,1800,1802,1803,1804,1805,1806,1807,1808,1811,1812,1813,1814,1816,1817,1820,1821,1822,1823,1824,1825,1826,1827,1829,1831,1832,1833,1835,1836,1837,1838,1839,1840,1841,1842,1844,1845,1846,2150,2151,2152,2153,2154,2169,2171,2172,2173,2177,2178,2180,2181,2188,2189,2190,2192,2195,2196,2197,2464,2467,2468,2471,2473,2475,2478,2479,2640,2641,2642,2643,2644,2645,2647,2649,2650,2651,2653,2654,2657,2658,2659,2660,2663,2665,2666,2669,2670,2671,2672,2673,2674,2675,2676,2679,2680,2895,2896,2897,2898,2899,2900,2901,2902,2903,2904,2912,2913,2916,2917,2919,2920,2921,2923,2924,2925,2927,2929,2930,2943,2944,2945,2946,2947,2948,2949,2950,2951,2952,2954,2955,2959,2960,2961,2962,2963,2964,2965,2966,2967,2968,2969,2970,2971,2972,2973,2974,3213,3214,3215,3216,3217,3218,3220,3221,3222,3223,3224,3225,3226,3227,3228,3233,3234,3235,3236,3237,3241,3242,3243,3246,3247,3248,3249,3250,3254,3255,3256,3257,3258,3259,3260,3261,3262,3263,3264,3265,3266,3267,3268,3269,3270,3285,3328,3334,3341,3343,3344,3345,3346,3388,3389,3390,3391,3519,3629,3630,3631,3661,3692,3694,3695,3696,3710,3721,3723,3724,3728,3729,3730,3731,3739,3741,3743,3744,3751,3754,3763,3764,3765,3766,3771,3772,3773,3777,3778,3779,3780,3781,3782,3783,3784,3785,3787,3788,3789,3790,3791,3794,3795,3796,3797,3798,3799,3801,3802,3803,3804,3805,3806,3807,3808,3809,3811,3812,3813,3814,3816,3817,3819,3820,3821,3823,3824,3825,3834,3835,3836,3838,3839,3862,3864,3865,3866,3867,3868,3869,3870,3871,3872,3873,3874,3950,3951,3978,3979,3982,3983,3984,3985,3986,3987,3988,3997,3998,4000,4001,4002,4003,4004,4016,4017,4018,4023,4024,4025,4026,4028,4030,4031,4049,4116,4131,4133,4141,4145,4146,4147,4153,4156,4157,4158,4168,4179,4180,4188,4189,4190,4212,4213,4215,4216,4219,4220,4231,4293,4294,4295,4296,4297,4299,4301,4302,4303,4304,4305,4308,4309,4317,4318,4319,4324,4325,4326,4327,4328,4329,4330,4332,4345,4359,4360,4361,4362,4363,4364,4365,4366,4367,4368,4369,4370,4371,4372,4373,4381,4383,4387,4388,4389,4408,4409,4410,4439,4440,4463,4483,4484,4494,4496,4502,4524,4543,4544,4598,4599,4602,4603,4604,4701,4706,4707,4708,4709,4713,4718,4721,4722,4723,4751,4753,4755,4766,4767,4768,4769,4770,4823,4824,4902,4903,4904,4906,4907,4908,4909,4910,4911,4912,4913,4914,4915,4918,4935,4936,4937,4938,4939,4940,4941,4981,4983,4984,5006,5007,5008,5010,5049,5050,5051,5181,5182,5222,5223,5355,5356,5364,5400,5401,5402,5403,5405,5406,5407,5409,5410,5411,5412,5413,5414,5415,5416,5417,5418,5419,5421,5431,5433,5434,5435,5436,5439,5441,5442,5443,5446,5447,5448,5449,5452,5453,5454,5455,5456,5474,5475,5476,5479,5480,5481,5482,5483,5484,5486,5487,5490,5491,5492,5493,5494,5495,5496,5506,5523,5525,5540,5543,5544,5545,5546,5547,5548,5549,5550,5552,5553,5554,5556,5564,5709,5710,5711,5712,5723,5726,5727,5728,5729,5730,5731,5732,5733,5735,5736,5737,5749,5996,5997,6068,6071,6072,6074,6103,6104,6105,6106,6115,6116,6117,6118,6132,6134,6135,6149,6151,6152,6153,6154,6259,6264,6269,6270,6272,6296,6300,6301,6335,6336,6470,6471,6567,6568,6569,6570,6571,6572,6573,6574,6575,6579,6580,6588,6600,6601,6602,6603,6605,6691,6692,6693,6694,6822,6823,6824,6826,6832,6833,6834,6835,6836,6837,6838,6839,6840,6841,6842,6843,6844,6845,6858,6859,6860,6861,6862,6863,6864,6865,6866,6867,6869,6870,6871,6904,6905,6906,6918,6919,6920,6921,6930,6931,6932,6933,6934,6935,6936,6937,6938,6939,6943,6945,6946,6947,6948,6949,6950,6951,6952,6953,6954,6955,6956,6957,6958,6959,6960,6961,6962,6963,6964,6965,6966,7031,7032,7033,7035,7037,7087,7088,7089,7090,7091,7092,7191,7244,7262,7294,7295,7296,7297,7298,7299,7324,7353,7354,7356,7358,7374,7375,7376,7377,7378,7379,7380,7381,7382,7384,7397,7398,7408,7411,7412,7422,7456,7459,7461,7467,7468,7470,7472,7474,7475,7496,7497,7504,7505,7506,7507,7508,7509,7540,7541,7571,7572,7573,7880,7881,7911,7912,8056,8360,8361,8362,8363,8364,8386,8402,8505,8506,8507,8686,8687,8688,8692,8693,8694,8700,8701,8736,8737,8781,8782,8818,8819,8820,8860,8862,8869,8870,8871,8872,8873,8874,8875,8876,8999,9000,9004,9015,9016,9072,9111,9146,9148,9220,9221,9223,9235,9245,9377,9378,9379,9380,9429,9430,9431,9432,9433,9439,9440,9449,9534,9535,9536,9537,9603,9604,9605,9606,9649,9650,9651,9676,9677,9681,9687,9688,9699,9700,9729,10093,10094,10095,10132,10133,10157,10158,10159,10305,10307,10308,10309,10310,10311,10314,10330,10364,10365,10367,10373,10374,10376,10377,10379,10380,10382,10383,10386,10395,10396,10397,10414,10433,10434,10485,10487,10488,10489,10524,10541,10542,10552,10553,10554,10555,10564,10568,10569,10573,10575,10577,10578,10580,10585,10587,10592,10594,10599,10600,10602,10640,10641,10645,10646,10647,10649,10651,10653,10655,10657,10661,10686,10698,10699,10701,10703,10704,10705,10707,10711,10712,10713,10718,10719,10746,10778,10831,10834,10851,10894,10936,10937,10946,10947,10948,10949,10950,10951,10952,10953,10964,10966,10998,11006,11007,11008,11013,11018,11019,11020,11021,11022,11023,11024,11025,11026,11027,11075,11079,11080,11114,11115,11116,11117,11118,11120,11121,11150,11152,11208,11220,11299,11300,11301,11302,11310,11311,11312,11313,11315,11316,11317,11318,11319,11330,11331,11333,11336,11337,11346,11347,11348,11409,11410,11411,11412,11413,11417,11418,11421,11422,11423,11424,11425,11426,11427,11430,11437,11516,11526,11620,11623,11624,11631,11653,11654,11655,11745,11757,11758,11833,11838,11839,11840,11841,11842,11843,11844,11845,11846,11868,11869,12131,12132,12133,12134,12135,12136,12415,12416,12417,12420,12436,12554,12590,12591,12592,12593,12594,12595,12597,13086,13087,13104,13105,13106,13107
\ No newline at end of file
This diff is collapsed.
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment