Comments (1)
The navigation SDK’s RouteProgress class has some conveniences for this kind of thing, but MapboxDirections tends to stick to functionality that’s provided by the Directions API itself.
Is there a way to get the eta for a certain Waypoint directly?
Each route leg goes from one waypoint to the next, so this snippet gets you the expected travel time from the origin to the intermediate waypoint at index waypointIndex
, and you can modify it to compute other statistics instead:
// Get the legs up to the waypoint.
let precedingLegs = route.legs.prefix(waypointIndex)
// Sum up the legs’ ETAs.
let expectedTravelTime = precedingLegs.map(\.expectedTravelTime).reduce(0, +)
// Shift the current date forward by the ETA.
let arrivalDate = Date() + expectedTravelTime
It would also be interesting to be able to display that time to the nav ui.
That does sound interesting. Would you mind elaborating on this idea in a new issue in https://github.com/mapbox/mapbox-navigation-ios/issues/? Thanks!
from mapbox-directions-swift.
Related Issues (20)
- Compiler error subclassing RouteOptions — required initializer must be provided by subclass HOT 6
- Add traffic control device flags to Intersection HOT 1
- Add TollCollection.name
- Command line tool should accept URL as input HOT 1
- Update minimum Turf version to v2.4.0
- Add closure attribute option
- Replace AttributeOptions with more extensible type HOT 1
- Unable to configure API endpoint using command line tool
- Command line tool should accept multiple configurations HOT 1
- Build universal framework target for Carthage
- Making `RouteResponse` `Equatable` and the `identifier/uuid` value HOT 6
- RouteResponse and MapMatchingResponse are undocumented
- Documentation lacks method signatures
- The 'cashTollOnly' RoadClasses value causes directions request to fail. HOT 2
- RouteStep "names" property is nil for walking directions HOT 2
- Directions calculation failing for some waypoints HOT 6
- Could not find module 'MapboxDirections' for target 'arm64-apple-ios-simulator' HOT 1
- Incompatible versions of Turf between MapboxMaps 10.16.5 and MapboxDirections HOT 2
- Incompatible versions of Turf between MapboxMaps 11.4 and MapboxDirections 2.12 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mapbox-directions-swift.