- Corey Amorin
Clarifying Questions:
- Car , public transport, walk, bike -> lets focus on car
- Include real-time traffic? Leave now or leave at another specified date/time ? -> include traffic, leave now
- Scope – initial calculation or adaptive calculation till destination is reached? lets start with initial and then add the adaptive
- any other customization options to consider (avoid tolls, highways, weather etc ) -> ignore
Framing the answer : Data needed :
- Route from A to B, (divided into discrete road segments each with a segment id) with turn by turn instructions
- Typical driving speeds on the route from A to B by segment (based on historical data) and by time-segment (lets assume 15 min segment, so 96 segments per day)
- realtime traffic data (Current moving speed of cars on the route between A to B) by segment & time-segment
Calculation : Sum (each segment distance * speed) for all segments between A to B
Lets now consider each of the data points needed : segments – Critical piece to tag information Given that maps can identify the small section of road from my house, this segment length likely to be <50m , for simplicity assume 25m Route from A to B divided by segments : This requires roadways data and a service to calculate the turn-by-turn instructions between A to B. Map data is available easily from external sources, but this can also be obtained from historical trip data stored within Google , users running GPS & maps. Typical driving speeds between A to B by segment : Broken by segment id, this data can be fetched from historical trip data of all google maps users who have driven that segment ,during this time-segment. To limit the search query, we can time-bound for past 30 days for this information real-time traffic data by segment and time-segment: this information will be retrieved based on current stored information (Current time-segment- avg moving speed of cars using google maps, for each segment. This can be saved on the local device cache, to utilize for the adaptive compute.
Initial ETA : Current timestamp + Sum (25m * avg speed for current time-segment) for all segments between A to B
TO calculate adaptive ETA, The user presses start now and ETA starts with the initial ETA Lets say there are n segments between A to B (S1,s2,s3….sn) as the user crosses from one segment to another, Maps will send the remaining segment ids till B and check for updated information of avg speed for current time-segment for all segments between current segment to B . Using the existing cached data, the ETA is adapted as ; adaptive ETA ( after S1 is passed) : Current timestamp + Sum (25m * avg speed for current time-segment) for all segments between S2 to B The avg speed within the current time-segment could be constantly changing based on new users, new data points added etc.
This focuses mainly from the client POV, i havent discussed about the data that goes to the server and is used for the average value calculations
A few edge cases : What if a Route A to B has a missing segment ? the segments can be classified as street, highway, tollway, community roads, dirt road etc. THis way, even if a segment is idneitfied to be missing with tagged data, it at least will exist and can be leveraged with predicted speeds what if a segment has no tagged data (speed etc) : Ideally , google’s car would have gone to these segments to collect initial sample data. Else based on previous segment type, we can assign default speed values Average vs median – Median speeds are better to avoid skewed by outliers. Sample size of data needs to be considered, if a segment does not have many samples (lets say >10) then leverage predicted speed rather than calculated median

Google