-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
Check a current active route link for any long route for an example. The route starts and ends at the Lockon but the last (n-9) drops will be missing.
Apparently, there's a limit on the number of waypoints a route can have when using the free version of the Maps API (source: lots of stackoverflow etc results for similar complaints).
Possible workarounds:
- don't display the Route buttons for longer routes, to avoid confusion
- mitigate by removing any duplicate waypoints before calculating route, e.g. at
const plusCodes = routeData.deliveries.map(item => item.plus_code); - for longer routes, have Route Pt 1/Route Pt 2 buttons?
☹️ - attempt a hack: based on aforementioned stackoverflow etc results, I discovered (by fiddling around in the URL bar) that replacing
cck-volunteer-web-app/components/deliveries-list/DeliveriesList.jsx
Lines 80 to 86 in fcff3cf
const googleRouteUrl = `${ googleRouteBaseUrl }/?api=1&origin=${ originForUrl }&waypoints=${ plusCodes.map(encodeURIComponent).join('|') }&destination=${ originForUrl }`;
with something like
const googleRouteUrl = `${ googleRouteBaseUrl }/{
originForUrl
}/{
plusCodes.map(encodeURIComponent).join('/')
}/{
originForUrl
}`;
does actually show all the waypoints. (It ignores travelmode
, though, even when the &
is corrected to ?
, which would be misleading for cyclists as the default is car.) Using URL hacking rather than the proper API would be brittle, though.
Metadata
Metadata
Assignees
Labels
No labels