Project-OSRM / osrm-backend

Open Source Routing Machine - C++ backend
http://map.project-osrm.org
BSD 2-Clause "Simplified" License
6.43k stars 3.4k forks source link

Routing service api returns wrong coordinates in response #7027

Closed BasharMahajne closed 2 months ago

BasharMahajne commented 2 months ago

Working to calculate distance and ETA from 2 long,lat but in the response it show another coordinates 1: longitude: 32.524821 latitude: 35.161340

2: longitude: 32.533417 latitude: 35.149612

https://router.project-osrm.org/route/v1/driving/32.524821,35.161340;32.533417,35.149612?steps=false

The response i got : { "code": "Ok", "routes": [ { "geometry": "}xouEqaqeE}pCseJdeE_rCgzIehFpwKyie@kwMiee@c\oju@_mOtGodBqbHyteEkymBopIkmHgBc{QgyO{rXanj@_ss@ohUsuLav[iil@d\\cxYqfJmdLkzEsdi@~{Ho}tAwiBiaeAbbLmim@pyReyHbwf@zB~eU~lLxrEkVtjGmXc_JaqPdb@oaO|P{yNp~RggAh_Tu~b@~fr@tnOhfDos[nxEmq@xrr@dn[xi\rc@zo~@{vZfkmA|_P~zwBmzJj{b@~vKbrYltX`EguD~~SjaOb}Lll[l|OryGzqF~}\\pco@qh@|dHxpS~re@eqDuiIpgH~{a@tr~@sfEv}I~`Fz|G", "legs": [ { "steps": [], "summary": "", "weight": 135280.5, "duration": 61302.9, "distance": 1132222.7 } ], "weight_name": "routability", "weight": 135280.5, "duration": 61302.9, "distance": 1132222.7 } ], "waypoints": [ { "hint": "6QZXh_sGV4cMAAAAAAAAAJUBAAATAQAAeJyXQQAAAABPbRtEXp3RQwwAAAAAAAAAlQEAABMBAABTCgEAmGnwATlQGAK6U_ABImgYAhEATwMcClna", "distance": 849.234132194, "name": "Charalambos Fournides", "location": [32.532888, 35.147833] }, { "hint": "Xlb9gdifypAAAAAAMAAAAAAAAADaFgAAAAAAANo_VkEAAAAA7C_LRAAAAAAwAAAAAAAAANoWAABTCgEA9UgcAmn79AHYiRgCP03wAQAArwUcClna", "distance": 41078.557074714, "name": "", "location": [35.408117, 32.832361] } ] }

jcoupey commented 2 months ago

From the response, you can tell the second waypoint has been snapped some 41km away, which probably explains the difference. You have a snapping problem, so probably want to double check your input coordinates.

BasharMahajne commented 2 months ago

The input coordinates is good as i checked. So what means snapping problem, how this can be resolved ? Actually this is wired problem, cause this must be more easier than this like Google Maps API

Here is same coordinates given here, response must be : 1.8 km, 7 min

https://map.project-osrm.org/?z=15&center=32.529140%2C35.154705&loc=32.524821%2C35.161340&loc=32.533417%2C35.149612&hl=en&alt=0&srv=1

jcoupey commented 2 months ago

longitude: 32.524821 latitude: 35.161340

That is in the sea. The OSRM API expects lon, lat.

jcoupey commented 2 months ago

Closing as answered.