flitsmeister / maplibre-navigation-ios

Repo is moved to https://github.com/maplibre/maplibre-navigation-ios
Other
6 stars 5 forks source link

Modified rerouting logic so we also apply a similar slower route for when a trafficjam occurs #21

Closed KasparElmans closed 1 year ago

KasparElmans commented 1 year ago

Description

Currently we only apply the route when the route is faster (that is what the logic is used for), so the same route with a slower ETA is not applied.

In this PR I've modified the rerouting logic, so we can display more accurate ETA's within the client app. This is especially important when the user drives towards/within a traffic jam.

Rerouting logic:

Every 2 minutes we ask for a new route.

When do we apply a new route?

Before:

After:

Regarding geometry check: We assume the geometry from the routing endpoint is stable. It uses simple coordinate comparison checks (optimising for performance).

Summary of changes

How to test

Run the new tests for yourself and check if they are valid