Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Different distance/duration on local engine #3370

Closed
Robatjazi opened this issue Nov 27, 2016 · 20 comments
Closed

Different distance/duration on local engine #3370

Robatjazi opened this issue Nov 27, 2016 · 20 comments

Comments

@Robatjazi
Copy link

Hi All,

I am pretty new on using OSRM. I am using it on my local machine and using alberta-latest.osrm. I got it on web. My issue is that I am getting different distance/duration than values when use online OSRM (http://map.project-osrm.org). I am just wondering of to is different map data that I am using.
Which data is used on http://map.project-osrm.org? and how can I get correct map street data for Canada?

Thank you in advanced.

@daniel-j-h
Copy link
Member

http://map.project-osrm.org is our demo server - it runs on a r3.4xlarge AWS EC2 box and cycles in 1/ the latest osrm code pulling from master (think: nightly builds) and 2/ a new OSM planet with the latest changesets applied. *

For OSM extracts Geofabrik is great - http://www.geofabrik.de/data/download.html
There are also smaller metro extracts from Mapzen - https://mapzen.com/data/metro-extracts/

Also check the documentation and beware of latitude / longitude mixups, which might explain different responses ;)

Please report back if this helps you getting started!

* unless things break then there might be some days in between until we fix the issue

@Robatjazi
Copy link
Author

Hi Daniel,

Thank you for your help. I got the latest pbf file and no difference.
It should not be latitude / longitude mixups as the difference is just couple of minutes in duration and couple of km in distance.

I just realized there is lua file for car, foot and bicycle which are used on extract pbf file. I am using default lua files. Is it possible that you are using different lua files on demo server? and this is the reason of differences?

regards,
Majid

@danpat
Copy link
Member

danpat commented Dec 1, 2016

@Robatjazi The demo server uses car.lua.

Run:

./build/osrm-extract -p profiles/car.lua your_file.osm.pbf

and you should get roughly the same results as the demo server.

@danpat
Copy link
Member

danpat commented Dec 1, 2016

@Robatjazi You also didn't mention which version of OSRM you are using - the demo server runs the latest master branch code from GitHub.

@Robatjazi
Copy link
Author

Robatjazi commented Dec 2, 2016

Thanks for your reply danpat.

I got the latest release binaries (on windows) and used the latest profiles.
Also I got the latest Alberta pbf file from http://www.geofabrik.de/data/download.html
I think the results are closer but still I see difference on result. For example:
point 1: 53.58037,-113.47843
point 2: 53.6524966,-113.5845262
Demo server results: 18.2 km, 25 min
My local results: 16.1 km, 26 min

There are a lot examples like this.

Regards,
Majid

@danpat
Copy link
Member

danpat commented Dec 2, 2016

@Robatjazi The demo server gives me the below response for this query (using your coordinates

https://router.project-osrm.org/route/v1/driving/-113.47843,53.58037;-113.5845262,53.6524966?overview=false&alternatives=false&steps=false&hints=;

If you replace "router.project-osrm.org" with "localhost:5000" and run this query locally, do you get the same response as below? I just did a quick test locally (on macOS) and I get the same results as the demo server.

If you're entering coordinates into the osrm-frontend GUI, please note that they get reverse-geocoded - thus, they can get moved quite some distance.

In addition - if you have alternatives=true set, make sure you're looking at the route with the smallest duration value - alternatives are not guaranteed to be consistent across platforms/versions/processing runs.

If all that looks good, can you please paste a full log of all the commands you ran to perform the route, and the exact URL you're hitting to get your response?


{
   "code":"Ok",
   "routes":[
      {
         "legs":[
            {
               "steps":[

               ],
               "summary":"",
               "duration":1515.3,
               "distance":18246.9
            }
         ],
         "duration":1515.3,
         "distance":18246.9
      }
   ],
   "waypoints":[
      {
         "hint":"p7-Whf6_loUAAAAAbwIAALEBAAAAAAAAAAAAAPTjawPf5gAAVXM8-VSSMQPidDz5UpIxAwAAAQHEwdXo",
         "name":"",
         "location":[
            -113.478827,
            53.580372
         ]
      }
   ]
}

@oxidase
Copy link
Contributor

oxidase commented Dec 2, 2016

@danpat i could reproduce it locally, it is tie breaking between two alternative pathes. Here is demo server response for https://router.project-osrm.org/route/v1/driving/-113.47843,53.58037;-113.5845262,53.6524966?overview=full&geometries=geojson

"duration": 1515.3,
"distance": 18246.9

and local master http://127.0.0.1:5000/route/v1/driving/-113.47843,53.58037;-113.5845262,53.6524966?overview=full&alternatives=false&geometries=geojson

"distance": 16433.5, 
"duration": 1502.1,

Paths are different https://gist.github.com/oxidase/f053c1972555d60109d8a0aa21d16124
but durations are quite close. Looks like there is a difference (precision?) in weights calculation between demo server and local master.

@Robatjazi
Copy link
Author

Thank you danpat.

I tried with alternatives=true and I am getting 2 rioutes. I guedd by default osrm demo GUI just shows the rout with minimum duration.

I tries same request on osrm demo and my local service and the results are:
osrm demo server:
https://router.project-osrm.org/route/v1/driving/-113.47843,53.58037;-113.5845262,53.6524966?overview=false&alternatives=true&geometries=geojson
route 1:
"duration": 1515.3,
"distance": 18246.9
route 2:
"duration": 1523.1,
"distance": 15292.5

local server:
http://127.0.0.2:5000/route/v1/driving/-113.47843,53.58037;-113.5845262,53.6524966?overview=false&alternatives=true&geometries=geojson
route 1:
"duration": 1559.9,
"distance": 16108.9
route 2:
"duration": 1570.1,
"distance": 18246.9

I cannot explain why there is difference. Any Idea?
As I said before I am using latest engine, Alberta pbf file and profiles.

Regards,
Maujid

@danpat
Copy link
Member

danpat commented Dec 3, 2016

For debugging this, we can ignore the alternative route - it is in no way guaranteed to be the "second fastest route".

My results match @oxidase. I'm using using master at 3f07a83, and http://download.geofabrik.de/north-america/canada/alberta-latest.osm.pbf dated 2016-12-02T20:28:03Z, and I'm on OSX.

http://127.0.0.1:5000/route/v1/driving/-113.47843,53.58037;-113.5845262,53.6524966?overview=false&alternatives=false&geometries=geojson

{
   "waypoints":[
      {
         "location":[
            -113.478827,
            53.580372
         ],
         "hint":"_icJgFUoCYAAAAAAbwIAALEBAAAAAAAAAAAAAMJfBQCDAAAAVXM8-VSSMQPidDz5UpIxAwAAAQGfXHZh",
         "name":""
      },
      {
         "location":[
            -113.584572,
            53.652465
         ],
         "hint":"s-gDgL3qA4BAzgAAHwAAACkAAADrAAAAAAAAAAOCAgCDAAAARNY6-fGrMgNy1jr5EKwyAwMAAQGfXHZh",
         "name":"Kingsway Drive"
      }
   ],
   "routes":[
      {
         "distance":16433.5,
         "duration":1502.1,
         "legs":[
            {
               "distance":16433.5,
               "steps":[

               ],
               "duration":1502.1,
               "summary":""
            }
         ]
      }
   ],
   "code":"Ok"
}

This differs from the demo server, but the demo server is running code that's a few days old, and a map that's a few days old - either could've changed.

@Robatjazi Your results do not line up with anything we're seeing. Can you please provide some more explicit details of your setup? "latest" is not sufficient, because things are changing every day.

Can you please furnish us with:

  • The URL you downloaded OSRM from, and the datestamp & md5sum of the file.
  • The URL you downloaded the .osm file from, and the datestamp on it.

These details are important - the problem could be that you're running on outdated code/profiles (despite thinking you're on "latest"), but we won't know without verification.

It's possible that there's a Windows vs Linux/OSX difference, but I would like to eliminate the more likely scenario of user error first.

@Robatjazi
Copy link
Author

I got osrm from:
http://build.project-osrm.org (Release build (December 04 2016 16:41:53 CEST))

I got pbf file for Alberta from:
http://download.geofabrik.de/north-america/canada/alberta.html (alberta-latest.osm.pbf)
md5: 035de1b3773c2e7b606e4d8dc3dcf0f9

@daniel-j-h
Copy link
Member

Any updates here? Can you give it a try with the latest 5.6 release and make sure to use the bundled profile?

@Imgametal
Copy link

I have same problem.
i download russia-latest.osm.pbf https://download.geofabrik.de/russia.html
and extract in latest docker container with latest image (engine veriosn (5.22) ) with car profile.
in result, i have very strange route. But, in online OSRM is all OK.
http://map.project-osrm.org/?z=14&center=58.214222%2C33.479462&loc=58.214911%2C33.470429&loc=58.688909%2C31.757117&hl=en&alt=0

http://router.project-osrm.org/route/v1/car/33.467704,58.211675;31.760593,58.688636?geometries=polyline6&overview=full

in my case -
image
http://localhost:5000/route/v1/car/33.467704,58.211675;31.760593,58.688636?geometries=polyline6&overview=full
distance is 299km.
problem is done, if i use old car profile - from verison 5.5. But i need "exclude" functions (since 5.12)
What i doing wrong?
Thanks.

@SystemParadox
Copy link

I seem to be having the same issue. The demo server gives the correct distance of 1.2 miles, but our local docker service is giving 4.2 miles. I've completed redownloaded and updated both the data and the docker image+container and I'm getting the same result.

I'm running the latest osrm/osrm-backend docker image (54e48d7fc5a7a7886c3e30e097587c1d126d55544b2d889f92b11b6b81846def).

https://download.geofabrik.de/europe/great-britain-latest.osm.pbf
29610f60444cf3d2cb7dc3dc7d1e3063  great-britain-latest.osm.pbf

@danpat
Copy link
Member

danpat commented Feb 18, 2019

@SystemParadox Did you compare the actual route geometry being returned?

If the distance is that different, then a different route is being selected. You'd have to look at the details to understand why.

@SystemParadox
Copy link

It looks to be something to do with the bridge. On the demo it's returning the correct route, using the B3233.

From the distance, it appears that my local installation is avoiding this bridge and instead going all the way around and using the A39 instead.

There is a weight limit on the bridge, but I'm using the /opt/car.lua profile so I'd expect it to do the right thing. I just used the instructions for the example docker setup, I haven't done anything special. What else should I look for? How can I work out if it's avoiding the bridge because of the weight restriction?

Thanks.

@chaupow
Copy link
Member

chaupow commented Feb 19, 2019

osrm serves debug tiles on which you can see the speed/weight/turn restrictions.

You can see the tiles using https://github.com/Project-OSRM/osrm-frontend and then navigate to the debug files via one of the buttons on the bottom left.

Make sure to change the backend on your frontend following this:
https://github.com/Project-OSRM/osrm-frontend#changing-backends

hope that helps :)

@SystemParadox
Copy link

SystemParadox commented Feb 20, 2019

Thanks that's really helpful!

I'm not entirely sure what it's supposed to do with bridges, but it appears that the B3233 bridge is missing? The A39 shows coloured like all the other roads, but the B3233 is just missing. Unfortunately the live demo isn't showing the debug information so I can't compare it.

The data from geofabrick.de appears to be up to date. I tried loading it in JSOM, but it seems to be in a format which isn't suitable for editing (missing changeset numbers, among other things).

How can I sensibly inspect the osm/pbf data to see if the bridge exists there? If it doesn't, how do I find out where it went missing? Where does geofabrik.de get their data from?

@SystemParadox
Copy link

SystemParadox commented Feb 20, 2019

I've found the problem! The bridge has a weight limit of 3 tonnes, but the provided /opt/car.lua has vehicle_weight = 3500 (kg). See also #5370, #5371.

I wonder what settings the live demo uses?

@chaupow
Copy link
Member

chaupow commented Feb 20, 2019

I don’t know which profile exactly is running on the demo server but in any case, your problem should hopefully be fixed soon with this PR😁

#5371 (comment)

@SiarheiFedartsou
Copy link
Member

Stale.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants