Project-OSRM / osrm-backend

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

Add bearing to Response Message #1636

Open Selikoff opened 9 years ago

Selikoff commented 9 years ago

The "/match" and "/locate" services are excellent for map-matching a vehicle to a road. Would there be much effort in updating these services to return a bearing value (0 to 360) in the list of response fields? For bi-directional roads or intersections, I can understand this being ambiguous for the "/locate" service, but for one-way streets or places where a list of points was passed to "/match", the direction should be able to be determined using the road and history data.

TheMarex commented 9 years ago

@Selikoff you get the full geometry of the road in the response of the match plugin (and an index into the coordinate array to the point that corresponds with the input trace point). You can extract the bearing from the adjacent coordinates of the road.

Selikoff commented 9 years ago

Thanks @TheMarex, I'll give that a shot. Either way, it would be useful to have it as an output parameter in the response message.

Selikoff commented 8 years ago

@TheMarex Can you provide more details about how this would work? Would I just take the last two geometry points and compute the bearing between them? Also, how do the geometry points differ from the map matched points?

TheMarex commented 8 years ago

@Selikoff I'm sorry I actually confused the match response with viaroute. It is a little it more complicated:

Selikoff commented 8 years ago

Thanks @TheMarex, this is part of why it would be great if this was part of the /match service. This is a lot of steps to perform by the client.

Selikoff commented 8 years ago

@TheMarex I noticed /match instructions returns a "direction" field with labels N, S, E, NE, SE, etc. How about a simple modification to the instruction response object that returns the direction angle along with the direction?

daniel-j-h commented 7 years ago

I'm not sure if I fully understand your use-case but by now we have

https://github.com/Project-OSRM/osrm-backend/blob/master/docs/http.md#stepmaneuver-object

Is that good enough for your usage?

retorquere commented 6 years ago

I'm looking for something similar on the map-matching service. I am looking to match inductive loops to car trips, and the database of loops has a bearing to indicate which side of the road it's on. If I could get a road alignment of the road alignment (so N, S, E, NE, SE, etc or a bearing value) I could match that against the loop database.

mohd-akram commented 4 years ago

It would be nice to have the bearing as another annotation for each coordinate in the geometry.