Open Selikoff opened 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.
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.
@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?
@Selikoff I'm sorry I actually confused the match
response with viaroute
. It is a little it more complicated:
instructions=true
and geometry=true
to your match
queryReachViaLocation
(numeric values is 9
) instructions as outlined herevias
of the route)idx
of corresponds to the index in the coordinate array represented by geometry
bearing(geometry[idx-1], geometry[idx])
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.
@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?
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?
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.
It would be nice to have the bearing as another annotation for each coordinate in the geometry.
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.