Inspiration
Here in Vancouver, summer is for road trips and outdoor adventures, and I've started planning weekend road trips to explore different parts of beautiful British Columbia. But weather in the mountains can change suddenly, and rain at sea level could mean snow and sleet in the high mountain passes. To keep safe and stay ahead of any extreme weather, I often use a combination of Google Maps and a weather app to plan my route. With the launch of the Google Weather API, I thought why not combine it with the Routes API to build an app that provides real time weather updates for every stop on your journey.

What it does
Weather Along Route shows you weather conditions along your route. Users planning a trip enter their starting point, destination, and any stops in between where they want weather updates. The app then generates the route and retrieves the forecasted weather for each stop along the way. Perfect for planning road trips, delivery routes, or for everyday travel!
How we built it
As its name suggests, the Weather Along Route app is built on two main Google Maps Platform APIs, Weather and Routes:
- The Compute Routes endpoint of the Routes API is used to draw traffic aware route polylines on the map and calculate travel times and Estimated Arrival Times (ETAs) for each stop. Users can add up to 10 waypoints, and the API will automatically adjust the route, updating the polyline, ETAs, and traffic conditions for the entire trip
- The Forecast Hours endpoint of the Weather API provides detailed predicted weather conditions for up to 240 hours (10 days), starting at the current hour. This data is combined with the ETAs from the Routes API to retrieve the weather forecast at each stop exactly when the user is expected to arrive.
The frontend was built on React using the @vis.gl/react-google-maps library. You can read about how we built this app here: Google Maps weather along route: Weather-aware planner.
Challenges we ran into
The biggest challenge was syncing the weather condition with the arrival time at each stop. To do this, we iterate over each leg of the route returned by the Compute Routes endpoint of the Routes API, calculate the ETA for each stop, and then match each ETA to the corresponding hourly forecast from the Forecast Hours endpoint of the Weather API to get the weather at that specific time.
Accomplishments that we're proud of
I'm happy with how easy it is to combine the Weather API with other Google Maps APIs to build something cool and useful.
What we learned
It's striking how closely traffic patterns align with the weather - a connection made easy to see thanks to the real-time traffic polylines from the Routes API.
What's next for Weather Along Route
The team at Afi Labs is building white labelled versions of Weather Along Route for clients in the hospitality and travel sectors.
Built With
- google-maps
- google-routes-api
- google-weather-api
- react

Log in or sign up for Devpost to join the conversation.