Project-OSRM / osrm-backend

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

return distance from road network to destination point #2531

Open emiltin opened 8 years ago

emiltin commented 8 years ago

The last arrival instruction seem to indicate in the 'modifier' field wether the destination is on the left or right side of the road, which is very nice. The distance field is always zero, however. I suggest returning the distance from the road network to the location in the 'distance' field, measured simply as a straight line from where the route ends on the road network to the query location.

emiltin commented 8 years ago

the use case is being able to tell the user 'your destination is on the right side, 150 meters from the road'.

MoKob commented 8 years ago

@TheMarex whats your take on this? I wouldn't object.

TheMarex commented 8 years ago

Problem is how would do deal with:

The reason why all values are zero is to make this consistent with the idea of a "zero length" step. The value in question can be easily calculates via distance(wainpoints[i].location, input_locations[i]).

emiltin commented 8 years ago

I assume duration would be zero, since it depends on speed which is unknown outside the road network. Another option would be not to consider the distances to/from the road network as part any turn instructions, and instead place them in the route object.