Dash provides real-time diagnostics for your car using Google Maps APIs



Editor’s note: Today’s guest blogger is Brian Langel, Co-Founder and CTO of Dash. Read how the connected driving company, Dash, is using the Google Maps APIs in their real-time auto diagnostics app.

Dash provides real-time diagnostics for your car—think of it as Fitbit for automobiles. Our app connects to a car’s on-board diagnostics system and gathers information that can help you become a safer driver while saving you time and money. You can also use it to get accurate estimates for repairs and share your driving experiences with friends.
We use the Google Maps Roads API to reconstruct and visualize trips, so users can revisit where they’ve driven and share their trips with others. When we launched the Dash app in February 2014, the Roads API wasn’t yet available. We used reverse geocoding to turn GPS coordinates into visual routes. Users had two options: GPS polling every few seconds, which drained phone battery but resulted in better accuracy; or less-frequent polling, which saved battery life at the expense of accuracy.

Below you can see the reconstruction in action. On the left in blue is the route calculated with GPS information gathered by the app every eight to 30 seconds. On the right in blue is the route reconstructed using the Roads API. Note that the reconstructed route shows that the car took a main road, which Google Maps shows in orange in the left screenshot. The orange isn’t visible in the right screenshot because the blue line sits on top of it.
We started using the Roads API as soon as it was available. It was a no-brainer, since we’re a small startup without the resources to build a database that matches GPS coordinates to road locations. The comprehensiveness of the Roads API allows us to map all road locations in the US. Now that our app uses data from the Roads API, users don’t need to sacrifice their phone’s battery life to get an accurate route history. The app polls a phone’s GPS once every eight to 30 seconds, then strings the coordinates together using reverse geocoding and the Roads API.

We do this route reconstruction by telling the Roads API to match a trip’s GPS coordinates to specific road locations. Here’s an example of this code:
String url = String.format("%s%s&interpolate=true&key=%s", GOOGLE_ROADS_SNAP_URL,
                          pathEncoded, roadsKey);
ClientResponse response = client.resource(URI.create(url))
                                .accept(MediaType.APPLICATION_JSON_TYPE)
                                .get(ClientResponse.class);
if (!isSuccess(response)) {
 return handleFailure(response);
}
SnappedRoute snappedRoute = response.getEntity(SnappedRoute.class);
if (snappedRoute.getSnappedPoints() == null) {
 return Optional.absent();  
}
List snapped = convert(snappedRoute.getSnappedPoints());
Since launching our app, we’ve tracked millions of trips for our nearly 200,000 users. With the Roads API, we’ve given them more accurate histories of their routes and improved battery life. We’re looking to expand our use of the Roads API by getting speed limit information so drivers can use the app to better manage fuel efficiency and compare their actual speed with the legal limit. This is just one of the new features we’re considering as we think about ways to help people drive smarter.