NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

Hi,

I installed OSRM back-end on my ubuntu server. I downloaded france-latest.osm.pbf from GEOFABRIK and I filtered/extracted/contracted it to generate a file containing main highways as follows:

./osmconvert france-latest.osm.pbf -o=france-latest.o5m

./osmfilter france-latest.o5m --keep="highway=motorway =motorway_link =trunk =trunk_link =primary =primary_link =secondary =secondary_link" -o=france.mtps.osm

./osrm-extract -p profile.lua france.mtps.osm

./osrm-contract france.mtps.osrm

And finally I started the back-end osrm-routed as follows:

./osrm-routed ../osrm_files_france.mtps/france.mtps.osrm


The backend starts and responds but sometimes it return results that are different from what I would expect or from what the demo server at router.project-osrm.org returns. Here is an example where I want to get the distance between 2 GPS coordinates located on a motorway. The correct distance is 15.1 km, which is consistent with the distance returned by the demo server (15087.7 meters). However my server returns a different route with a distance of 17488.1 meters. I do not understand why I get a different route which makes little sense since the 2 points are located on a motorway same lane. Can anyone help ?

Find below the output returned by both my server and the demo server.

DEMO SERVER QUERY:

https://router.project-osrm.org/route/v1/driving/2.865504,42.464852;2.844055,42.573679?steps=true&continue_straight=true&overview=false

DEMO SERVER RESPONSE:

{"code":"Ok","routes":[{"legs":[{"steps":[{"intersections":[{"out":0,"entry":[true],"bearings":[350],"location":[2.865512,42.464853]}],"geometry":"i|dbGmtnPqFx@aBV","mode":"driving","duration":7.9,"maneuver":{"bearing_after":350,"location":[2.865512,42.464853],"bearing_before":0,"type":"depart"},"ref":"AP-7","distance":192,"name":"La Catalane"},{"intersections":[{"out":1,"location":[2.865101,42.466552],"bearings":[165,345],"entry":[false,true],"in":0},{"out":2,"location":[2.862913,42.471981],"bearings":[0,150,330],"entry":[true,false,true],"in":1},{"out":1,"location":[2.862552,42.472339],"bearings":[143,318,328,335],"entry":[false,true,true,true],"in":0},{"out":1,"location":[2.861841,42.472917],"bearings":[138,311,318],"entry":[false,true,true],"in":0},{"out":3,"location":[2.858814,42.474743],"bearings":[118,124,127,303],"entry":[false,false,false,true],"in":2},{"out":2,"location":[2.857274,42.475428],"bearings":[105,120,285],"entry":[false,false,true],"in":1},{"out":2,"location":[2.852842,42.476509],"bearings":[106,107,291],"entry":[false,false,true],"in":0},{"out":0,"location":[2.819492,42.523429],"bearings":[10,14,186],"entry":[true,true,false],"in":2},{"out":0,"location":[2.82549,42.531479],"bearings":[49,224,227],"entry":[true,false,false],"in":2},{"out":0,"location":[2.843981,42.572556],"bearings":[4,5,182],"entry":[true,true,false],"in":2}],"geometry":"}febG{qnPmBVwBZ{Dl@cDh@{A^{Ad@{@@aAd@{B|As@j@QPgAfAsBlCwDzGsDIgArCaA~CUlAg@dCq@lEgBrMg@jCc@dBs@|Bs@hBq@|AwB~D{BvDmBrCqAbB}AdByAjAsAAsAt@iBz@_Cv@cCr@yBf@aBZkAZ{@ZaAd@iAt@_At@eAdAcAjAmA~A{AxByAzBcCfEeEhImGnLwCpGmAtCyAbDiBrDkCfEkCdE}AtCmAxC_A|CaAbEuAjHw@DiAvDyAtD}AzCcAdB{AnBsA~As@r@cA|@oAAeAx@[PqAn@cA@uA^kB@_BX_CTeBLeCBaFKcJYeL]}Oe@oJ]yDUoESkJ]mHGaFK}EWgBQy@KgAI_@CcC_@oBe@aA[{@W{Ai@mAk@w@s@eCeCeBeAuA}@gB}@_CgAuAcAqAqAeDoE}BuDqA_CqAiCmAkCyAuDkBkF}CmJyCyJgIuWiCmHmEaLwCiGeCuE}BsD_B_CiDaEiBmByBoB{BeB}@i@}AaAcB_AaBw@oBw@yDiAcDs@kC_@_CSwDMaC?[?cDNqBLwBXgDn@cElAcCz@oHDkK|EiEdBiEzAgFvAiFlAwDp@aD`@sCZmDXwDRmDLcEHaEBgIC_CE_FS","mode":"driving","duration":607.1,"maneuver":{"bearing_after":350,"type":"new name","modifier":"straight","bearing_before":350,"location":[2.865101,42.466552]},"ref":"A 9","distance":14895.8,"name":"La Catalane"},{"intersections":[{"in":0,"entry":[true],"bearings":[184],"location":[2.844077,42.573677]}],"geometry":"odzbGonjP","mode":"driving","duration":0,"maneuver":{"bearing_after":0,"location":[2.844077,42.573677],"bearing_before":4,"type":"arrive"},"ref":"A 9","distance":0,"name":"La Catalane"}],"summary":"La Catalane, La Catalane","duration":615,"distance":15087.7}],"duration":615,"distance":15087.7}],"waypoints":[{"hint":"FGY5hP38ozcIAEgAAAEoAAAAAAAAAFwAAAI6rkwJtugAAaLkrAFX2hwJguSsAVPaHAgAAAQHnB7e-","name":"La Catalane","location":[2.865512,42.464853]},{"hint":"hkqVg_3-YLQwAKwAAAEMAAAAAAAAAJwEAABkiJAJtugAArWUrAG2fiQKXZSsAb5-JAgAAAQHnB7e-","name":"La Catalane","location":[2.844077,42.573677]}]}


MY SERVER QUERY:

http://hp-ubuntu:5000/route/v1/driving/2.865504,42.464852;2.844055,42.573679?steps=true&continue_straight=true&overview=false

MY SERVER RESPONSE:

{"code":"Ok","routes":[{"legs":[{"steps":[{"intersections":[{"out":0,"entry":[true],"bearings":[1],"location":[2.863181,42.464999]},{"out":0,"location":[2.863187,42.465234],"bearings":[0,180],"entry":[true,false],"in":1},{"out":1,"location":[2.862516,42.466707],"bearings":[150,345],"entry":[false,true],"in":0},{"out":0,"location":[2.857643,42.470223],"bearings":[0,180],"entry":[true,false],"in":1}],"maneuver":{"type":"depart","modifier":"right","location":[2.863181,42.464999],"bearing_after":1,"bearing_before":0},"mode":"driving","distance":6375.9,"duration":284.7,"geometry":"g}dbG{enPm@Aa@?Q?E?S@g@JWJc@PQNMJq@h@c@RcA^e@\@f@e@|@]^{@v@k@h@]|@Q|@I~@CfAEdBGp@Or@[x@a@r@q@n@y@@{@TeABsDBMAMCc@Ui@W[Gc@BULQN]XqBB@b@W^Uj@Kj@Cd@AdA@|ADp@Vz@^p@^\b@RnAPh@T\^Th@Hv@?t@Id@Sd@c@@g@Nc@?]Iw@[k@Sk@De@P_@XSVOd@MAWbIIdAK|@OlA?n@F~@DlAAj@I^M\a@b@k@\Bp@oCbAo@Ve@@q@x@e@Zo@Tc@@_@Ic@Ua@_@]Sk@Ig@Fa@TYb@Uj@Iv@EzCElAQbA]AqAvCg@z@c@Tg@Dc@EsAS@@a@P_@^q@z@sAzAkC~BwFhFMTMZIXAXAj@@zBCxBU|BYtBK^O\o@l@g@L[AWGqAq@cAm@aAo@uAi@q@Om@MYC}@B}@VcAb@iAx@m@r@}@vA}@rB_BjDINkBbEgBrDeAdBs@vAu@zAc@jA{@dBcAlBkAlBeAtAwAjBeB|Bu@~@{@hBc@bBe@fCgAbG]dBk@jAoACmBxCq@r@eBrAmAz@}Ap@_@Jw@HaAJm@C}AWs@Qa@S","name":"Avenue de France - Avinguda Catalunya","ref":"D 900"},{"intersections":[{"out":1,"location":[2.820866,42.500462],"bearings":[15,30,195],"entry":[true,true,false],"in":2},{"out":0,"location":[2.82127,42.500976],"bearings":[45,210,240],"entry":[true,false,false],"in":1}],"maneuver":{"type":"fork","modifier":"slight right","location":[2.820866,42.500462],"bearing_after":27,"bearing_before":22},"mode":"driving","distance":1779.5,"duration":90.1,"geometry":"{zkbGm}ePgAo@_@_@m@o@m@gAq@uAeAaCQYg@m@sB{A_BeAm@Qo@MaACg@Hk@VyAhAuAh@aADm@GmAWu@Wu@c@g@g@]q@e@gA_@g@g@]k@UCCe@Q_@Ya@g@}BuEe@a@EEEEaA{@IGgAcAiD}Cw@s@o@g@o@WgDuAgAc@_@SUS{@]g@U","name":"","ref":"D 900"},{"intersections":[{"out":0,"location":[2.830111,42.51384],"bearings":[90,195,300],"entry":[true,false,false],"in":1},{"out":0,"location":[2.83021,42.514115],"bearings":[15,120,270],"entry":[true,false,true],"in":1},{"out":1,"location":[2.831084,42.515735],"bearings":[15,30,210],"entry":[false,true,false],"in":2},{"out":0,"location":[2.831206,42.515916],"bearings":[25,36,207],"entry":[true,true,false],"in":2},{"out":1,"location":[2.831861,42.516932],"bearings":[15,30,195],"entry":[true,true,false],"in":2},{"out":2,"location":[2.832601,42.516816],"bearings":[89,97,282],"entry":[false,false,true],"in":0},{"out":1,"location":[2.831113,42.51715],"bearings":[105,285,300],"entry":[false,true,true],"in":0}],"maneuver":{"exit":1,"type":"roundabout","modifier":"right","location":[2.830111,42.51384],"bearing_after":94,"bearing_before":22},"mode":"driving","distance":926.6,"duration":61.4,"geometry":"onnbGewgP?KAKCKGEECGAG@EBEDCFCFmAi@cFyBQIc@Y_@SeAw@cAg@_@Ma@SGEa@a@Oa@Ge@@g@Hm@J_@R[PCN?TLN\\D\\?z@KtAc@pCQAQAeApFc@rA","name":"","ref":"D 900"},{"intersections":[{"out":2,"location":[2.829154,42.517766],"bearings":[120,135,315],"entry":[false,true,true],"in":0}],"maneuver":{"type":"new name","modifier":"slight right","location":[2.829154,42.517766],"bearing_after":313,"bearing_before":300},"mode":"driving","distance":678.3,"duration":30.5,"geometry":"agobGeqgPEHQXyHlK_@l@IRMXW|@I@Kf@MfACt@Cn@?fCApBE|@Ib@K\Qd@S^ORYPY@","name":"","ref":"D 900"},{"intersections":[{"out":0,"location":[2.822531,42.520756],"bearings":[45,180,240],"entry":[true,false,false],"in":1},{"out":2,"location":[2.821924,42.520958],"bearings":[15,165,240],"entry":[false,true,true],"in":0}],"maneuver":{"exit":1,"type":"roundabout","modifier":"right","location":[2.822531,42.520756],"bearing_after":43,"bearing_before":358},"mode":"driving","distance":512.5,"duration":29.4,"geometry":"wyobGygfPIMUK[BQJEFIZAZDXNXDDPFH@DPZn@Tr@H@Dz@C|@Cr@Ix@Mz@Mt@c@C]lB[fBO@AJ","name":"","ref":"D 900"},{"intersections":[{"out":0,"location":[2.817484,42.521392],"bearings":[0,120,195],"entry":[true,false,false],"in":1},{"out":2,"location":[2.817357,42.521642],"bearings":[135,300,330],"entry":[false,true,true],"in":0}],"maneuver":{"exit":1,"type":"roundabout","modifier":"right","location":[2.817484,42.521392],"bearing_after":0,"bearing_before":285},"distance":189.6,"duration":13.4,"geometry":"u}obGghePS?MDKHCFMNQD_@B]E[Gq@M_@GgA[","name":"","mode":"driving"},{"intersections":[{"out":0,"location":[2.817553,42.523017],"bearings":[0,15,195],"entry":[true,true,false],"in":2}],"maneuver":{"type":"fork","modifier":"slight left","location":[2.817553,42.523017],"bearing_after":7,"bearing_before":16},"distance":1311,"duration":82.6,"geometry":"{gpbGuhePkAMe@GMAIAsDg@c@M[WKOOa@GYGUGuB@mAFoDBcBAq@Gg@G]Ma@Q_@Y]c@Os@CuACmBUiDu@kFmA}@[y@c@c@_@y@u@aBsBaE}F","name":"","mode":"driving"},{"intersections":[{"out":0,"location":[2.82549,42.531479],"bearings":[49,224,227],"entry":[true,false,false],"in":1}],"maneuver":{"type":"merge","modifier":"slight left","location":[2.82549,42.531479],"bearing_after":49,"bearing_before":44},"mode":"driving","distance":5714.7,"duration":179.1,"geometry":"w|qbGizfPqA_CqAiCmAkCyAuDkBkF}CmJyCyJgIuWiCmHmEaLwCiGeCuE}BsD_B_CiDaEiBmByBoB{BeB}@i@}AaAcB_AaBw@oBw@yDiAcDs@kC_@_CSwDMaC?[?cDNqBLwBXgDn@cElAcCz@oHDkK|EiEdBiEzAgFvAiFlAwDp@aD`@sCZmDXwDRmDLcEHaEBgIC_CE_FS","name":"La Catalane","ref":"A 9"},{"intersections":[{"in":0,"entry":[true],"bearings":[184],"location":[2.844077,42.573677]}],"maneuver":{"bearing_before":4,"location":[2.82549,42.531479],"bearing_after":0,"type":"arrive"},"mode":"driving","distance":0,"duration":0,"geometry":"odzbGonjP","name":"La Catalane","ref":"A 9"}],"summary":"D 900, La Catalane","duration":771.2,"distance":17488.1}],"duration":771.2,"distance":17488.1}],"waypoints":[{"hint":"XYcCgPOkCIDktwEAEgAAAAAAAAAAAAAASQEAADj0AwBtFRMABBAAAE2wKwDn9ocCYLkrAFT2hwIAAAEBm5ShTg==","name":"Avenue de France - Avinguda Catalunya","location":[2.863181,42.464999]},{"hint":"40wAgP___38gMgAAJwAAAD0AAADYBgAA5gsAAPZyEAAcAQgABBAAAK1lKwBtn4kCl2UrAG-fiQI0AAEBm5ShTg==","name":"La Catalane","location":[2.844077,42.573677]}]}

asked 17 Jan '17, 08:12

06pboivin06's gravatar image

06pboivin06
11224
accept rate: 0%


Hi,

I checked with my own server and indeed, I got 15km too (taking AP-7 motorway).

Are you sure you don't have "ignore_toll_ways = true" in your profile.lua ? It could force osrm to calculate an "alternative" route if the speedway isn't free.

And just to be sure, coordinates from your example are in spain. You spoke about france-latest.pbf. I suppose it's another test...

Feel free to post your profile.lua file. It could be usefull to compare parameters.

Regards,

Thibaut

permanent link

answered 17 Jan '17, 10:31

ThibPhil's gravatar image

ThibPhil
411
accept rate: 0%

Just to be sure, do you have such problem everywhere on highways or only near the French/Spanish border ?

If not a lua configuration problem, it could be a snapping problem due to a missing motorway segment at the border (as you are using france-latest.pbf extract, I don't know where the road is "cut" in this file. If the last (close to the border) segment is missing, it'll snap on the first found way (and as you imported only motorway, trunk, primary and secondary, the nearest object is indeed "D900 - Avenue de France).

If you want, I can import the same PBF file and do some tests. If needed, feel free :-)

permanent link

answered 17 Jan '17, 18:12

ThibPhil's gravatar image

ThibPhil
411
accept rate: 0%

Thanks Thibaut for the hint, I'll check my profile.lua . The initial coordinate I gave (42.464852,2.865504), according to google maps (https://www.google.fr/maps/place/42%C2%B027'53.5%22N+2%C2%B051'55.8%22E/@42.4648559,2.8653672,21z/data=!4m5!3m4!1s0x0:0x0!8m2!3d42.464852!4d2.865504) is close to the border with Spain but in France. When I try to feed my coordinates to OSM directions (http://www.openstreetmap.org/directions?engine=osrm_car&route=42.4652%2C2.8657%3B42.5789%2C2.8450#map=12/42.5220/2.8417) , it positions the start point on the border with Spain, I guess it's because that is the closest node to 42.464852,2.865504 that is known in the OSM file.

permanent link

answered 17 Jan '17, 15:36

06pboivin06's gravatar image

06pboivin06
11224
accept rate: 0%

I think you are right Thibaut, it must be a snapping problem. I tried different origin coordinates progressing further and further inside France and when I reach enough inside France I get the same response as the Demo server. So the France OSM file must be missing a part of the French motorway and it snaps on the minor French road it finds closest. In fact, I get the same problem close to Italy border. In the center of France no such issues. Maybe I should try a to create a file resulting from merge of France plus the countries bordering France.

permanent link

answered 17 Jan '17, 19:54

06pboivin06's gravatar image

06pboivin06
11224
accept rate: 0%

Yes, you can merge different countries but maybe the easiest way for you should be to download europe-latest.pbf and to use osmosis (giving an extent covering France + surrounding area) to re-create a new PBF.

Or, if your server has enough RAM and perfs, you can try to compute osrm files on entire Europe (if needed, of course...). Just for information, for entire Europe, works fine with 40Gb RAM, 512Gb on SSD.

(18 Jan '17, 09:21) ThibPhil

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×1

question asked: 17 Jan '17, 08:12

question was seen: 3,956 times

last updated: 18 Jan '17, 09:21

Related questions

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum