mapbox-directions-swift icon indicating copy to clipboard operation
mapbox-directions-swift copied to clipboard

Add per-waypoint timestamp option for map matching

Open 1ec5 opened this issue 6 years ago • 3 comments

The Map Maching API has an optional timestamps query parameter. Currently, this library doesn’t offer a way to specify that parameter. Waypoint should have a timestamp property (of type Date). MatchOptions.getter:params should aggregate the timestamps of the waypoints into the timestamps parameter.

In https://github.com/mapbox/MapboxDirections.swift/pull/236#discussion_r172037100, I had suggested relying on CLLocation.timestamp, but it turns out that Waypoint stores coordinates and headings separately, not as part of a location. That should change, though not necessarily as part of fixing this omission.

It isn’t clear to me what should happen when one waypoint has a timestamp and another does not. Maybe this semicolon-delimited list can contain blank entries.

/ref https://github.com/mapbox/mapbox-navigation-android/issues/875#issuecomment-421332368 /cc @frederoni

1ec5 avatar Sep 14 '18 12:09 1ec5

What is the priority of this? It may not be realised that this has quite a high impact. For some reason, a lot of Map Matching requests that do not have any timestamps do not return any results. The same request with any random timestamps returns the expected route.

richjhart avatar Sep 14 '18 12:09 richjhart

First of all, thank you for bringing up this issue in https://github.com/mapbox/mapbox-navigation-android/issues/875#issuecomment-421332368. It appears to have been an oversight. I’ve flagged this issue for the team to triage.

If you need a workaround in the meantime, you can subclass Directions and override the following method to manually add the semicolon-delimited timestamps property according to this documentation.

https://github.com/mapbox/MapboxDirections.swift/blob/83f415007b8ff73c625bcb86054eb5355318fc10/MapboxDirections/MBDirections.swift#L301-L302

1ec5 avatar Sep 14 '18 12:09 1ec5

It isn’t clear to me what should happen when one waypoint has a timestamp, and another does not.

There must be as many timestamps as there are request coordinates, each separated by ; It sounds like we should fail hard if the timestamps are inconsistently annotated.

frederoni avatar Sep 14 '18 12:09 frederoni