Wondering whether a downpour will gridlock your commute or a snowstorm will delay your trip to the mountains? You can pair Mapbox Directions with API-based weather data to view both traffic and weather conditions along your route.

Drag the origin and destination markers on the map below. Our Directions API returns the optimal route based on real-time traffic.

Click the weather toggle, and the route line will be used to query the OpenWeatherMap API and style the roads: red for potentially hazardous conditions, orange for areas to exercise a bit of caution, and green for clear weather.

Icons along the route give more detail about drive time and conditions you’ll encounter, like sun, rain, sleet, or high winds.

Check out our other posts on mapping weather data, including custom wind barbs and storm cell tracking. Building a map or app that combines weather data with Mapbox tools? Show it off on Twitter @Mapbox!