Traffic update issue with MLD + customize + datastore #7093
Unanswered
SaadQRoutes
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have an OSRM instance setup locally with a datastore (v5.27.1) e.g.
F:\OSRM\bin\osrm-extract -p profiles\foot.lua data\os\os-foot-customised-yearly\OSMulti-modalRoutingNetwork.pbf
F:\OSRM\bin\osrm-partition data\os\os-foot-customised-yearly\OSMulti-modalRoutingNetwork.osrm
F:\OSRM\bin\osrm-customize data\os\os-foot-customised-yearly\OSMulti-modalRoutingNetwork.osrm
F:\OSRM\bin\osrm-datastore --dataset-name os-foot-customised-yearly data\os\os-foot-customised-yearly\OSMulti-modalRoutingNetwork.osrm
F:\OSRM\bin\osrm-routed --max-table-size=1000 --algorithm=MLD --port 5000 --shared-memory 1 --dataset-name=os-foot-customised-yearly --mmap 1
I have a requirement where users are able to block ways dynamically. I am using osrm-customize with a segment speed file to achieve this, and then osrm-datastore to load the changes on the running instance (I am aware that this can be done via the lua file but I dont want to waste time running through extract and partition needlessly) e.g.
F:\OSRM\bin\osrm-customize data\os\os-foot-customised-yearly\OSMulti-modalRoutingNetwork.osrm --segment-speed-file .\traffic\user_generated.csv
F:\OSRM\bin\osrm-datastore --dataset-name os-foot-customised-yearly data\os\os-foot-customised-yearly\OSMulti-modalRoutingNetwork.osrm --only-metric 1
Where the csv file will contain pairs of node ids and a speed e.g.
A,B,0
B,A,0
See https://github.com/Project-OSRM/osrm-backend/wiki/Traffic for reference.
This works well (e.g. for /route/v1/driving/-1.6315911,53.6920205;-1.6297767,53.6922304?overview=full&annotations=true):
{"waypoints":[{"name":"Bond Street","location":[-1.631584,53.692021],"distance":0,"hint":"KIBMgN6ATICiAAAA4AAAAAAAAAAkAAAAuKq0QaxG-EEAAAAA5CShQKIAAADgAAAAAAAAACQAAAACAAAAoBrn_3VGMwOgGuf_dUYzAwAAPxAcucgo"},{"name":"Bond Street","location":[-1.629777,53.69223],"distance":0,"hint":"d4BMgOCATIB7AAAAJQAAAGsAAAAOAAAApQiJQWIiokAcDm5B76zwP3sAAAAlAAAAawAAAA4AAAACAAAAryHn_0ZHMwOvIef_RkczAwEAbxAcucgo"}],"routes":[{"distance":247.9,"duration":178.5,"geometry":"cvufIjt}HH|A@LOSY[YWGCGGBW?QA]SoDC]|@UG_A?EAM","weight_name":"duration","weight":178.5,"legs":[{"distance":247.9,"duration":178.5,"weight":178.5,"summary":"","steps":[],"annotation":{"speed":[1.4,1.4,1.4,1.4,1.4,1.4,1.4,1.4,1.4,1.4,1.4,1.4,1.4,1.4,1.3,1.4],"metadata":{"datasource_names":["lua profile","os-foot-customised-yearly"]},"duration":[22.4,3.6,7.9,12,12.2,3,4.1,6,4.5,6.9,42.9,7.4,24.9,15.6,1.4,3.7],"distance":[31.034508624,5.035753144,10.999227560,16.728236597,16.953815826,4.155981799,5.746641927,8.317696817,6.282065938,9.551609644,59.623974980,10.221637282,34.621892287,21.675561645,1.880277463,5.066697347],"nodes":[500776105,232384254,506496747,212676692,212676693,212676694,212676695,507200451,226686601,226686602,504959099,224374229,504289238,502596606,506498164,215157216,215157217],"weight":[22.4,3.6,7.9,12,12.2,3,4.1,6,4.5,6.9,42.9,7.4,24.9,15.6,1.4,3.7],"datasources":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}}]}],"code":"Ok"}
However, if I then block an adjacent segment (i.e. running customize and datastore for the new pairs of nodes), I get:
{"waypoints":[{"name":"Bond Street","location":[-1.631584,53.692021],"distance":0,"hint":"KIBMgN6ATICiAAAA4AAAAAAAAAAkAAAAuKq0QaxG-EEAAAAA5CShQKIAAADgAAAAAAAAACQAAAACAAAAoBrn_3VGMwOgGuf_dUYzAwAAPxAcucgo"},{"name":"Bond Street","location":[-1.629777,53.69223],"distance":0,"hint":"d4BMgOCATIB7AAAAJQAAAGsAAAAOAAAApQiJQWIiokAcDm5B76zwP3sAAAAlAAAAawAAAA4AAAACAAAAryHn_0ZHMwOvIef_RkczAwEAbxAcucgo"}],"routes":[{"distance":248.4,"duration":838988.5,"geometry":"cvufIjt}HGaAQ}CEs@r@Q@?IsAK_AEg@q@ZHh@Br@","weight_name":"duration","weight":838988.5,"legs":[{"distance":248.4,"duration":838988.5,"weight":838988.5,"summary":"","steps":[],"annotation":{"speed":[1.4,0,0,1.4,1.4,1.4,1.4,1.4,1.4,1.4,1.4],"metadata":{"datasource_names":["lua profile","os-foot-customised-yearly"]},"duration":[16.2,419430.3,419430.3,21.3,0.7,20.6,15.7,9.9,20.5,10.7,12.3],"distance":[22.583359477,52.967951348,17.514522761,29.625428298,1.001690426,28.676430002,21.827375161,13.684641816,28.479125778,14.878445020,17.129220488],"nodes":[232384254,500776105,206300003,502596606,223957296,505122821,229130532,229130533,506613163,503675562,215157217,215157216],"weight":[16.2,419430.3,419430.3,21.3,0.7,20.6,15.7,9.9,20.5,10.7,12.3],"datasources":[0,1,1,0,0,0,0,0,0,0,0]}}]}],"code":"Ok"}
As you can see, the weights are extremely large for this case, even though the traffic documentation (https://github.com/Project-OSRM/osrm-backend/wiki/Traffic) says that without an extra comma after speed, the weights are recalculated based on the speed. I have tried.
I've noticed, that if I instead block both segments in a single customize and datastore call, then it works perfectly fine, as expected.
Specifying the rate myself in the .csv e.g. A,B,0,0 does not fix this issue. Keeping the same rate in the .csv e.g. A,B,0, also does not fix the issue.
Is this expected behaviour, and if so, what could I do to achieve the desired results? If not, please let me know.
Thank you
Beta Was this translation helpful? Give feedback.
All reactions