Find stops along your route using Bing Maps

***Updated June 2022***
Today, we would like to share more details about one of the new features in the Bing Maps called “along the route.” Our feature lets you find places along your current route, such as gas stations, coffee shops, hotels, and more.

We built this feature after hearing many customers complain about not knowing where to find interesting and convenient places that are not far off their driving path. A popular scenario to use this feature is for a road trip, so we will walk you through what a typical road trip might look like with Bing Maps.

Road trip to college orientation

For example, let’s say we’re headed to Samford University from Atlanta for a college orientation. We’ll be leaving Atlanta mid-morning, so we will probably need some caffeine along the way. To stay prepared and plan ahead, we’re going to want to find the coffee shops that will be on our route. It’s necessary to find coffee, gas and hotels along our route since we’re unfamiliar with this route.

map showing a route from Atlanta to Samford

By getting my directions from Atlanta to Samford University, we can automatically see in the “along the route” option in the directions card.

hotel and gas options in the along the route menu

All we need to do is click the coffee cup icon to see cafes along the way. The results here are chosen to be the 20 most relevant and closest cafes to our route, so we don’t have to detour too far off the highway. We can also use this feature to quickly find gas along our route in a pinch.

menu showing coffee shops along the route

If there’s a particular section of the route where we know we’ll need a break from driving, we can zoom into that area, and the coffee search results will refresh based on the map we’re looking at.

Routing with Local Search API

Under the hood, Local Search API is what makes it easy for users to find businesses like hotels along their route. Bing Maps API can find a collection of businesses centered around a given geographic region using an extensive repository of location data. Developers can designate this area in two ways: specifying a region with a radius or a bounding box denoted by a set of coordinates. 

Here’s what a query API request for a specified radius might look like:

https://dev.virtualearth.net/REST/v1/LocalSearch/?query={query}&userCircularMapView={lat,lon,radius}&key={BingMapsKey}

But what would searching for different types of businesses look like? Let’s say we’d like to find gas along our route:

https://dev.virtualearth.net/REST/v1/LocalSearch/?query=gas&userLocation=47.602038,-122.333964&key={BingMapsKey}

Just by setting the query parameter to ‘gas’, we can make a request to the Local Search API looking for gas stations in downtown Seattle. The API also supports searching through strings of type identifiers instead of queries.

map of coffee shops along a route

Once we choose the coffee shop we’d like to go to, we can add it to our route by clicking “directions.” If you’re taking a longer trip across the country, you can easily find gas and hotels along your route with this feature. Having the map rerouted with the new stops in mind will save you time and ensure that you’re always on the best possible route to your destination. Keep in mind that this routing also takes traffic conditions into account.

adding a coffee shop to the route

As we can see in the image below, a new path will be created once new stops are added to the route. The real-time traffic condition markers are particularly useful in potential emergencies along the route, such as having to find gas in a hurry.

The Traffic API allows for far more functionality than just indicating potential road congestion. Developers can use this API to incorporate real-time traffic incident data for a given area with a bounding box — with a limit of 500kmx500km. Providing users with routes that can account for both traffic congestion and real-time incidents makes for truly practical apps. A fast route from point A to B isn’t going to be any good if the road happens to be closed off.

Here’s a snippet of what a response to a query about two locations might look like:

   "coordinates":[  
                     38.85135,  
                     -94.34033
 
                  ]  
               },  
               "congestion":"",  
               "description":"MO-150 is closed between 5th Ave S and Court Dr - construction",  
               "detour":"",  
               "end":"\/Date(1310396400000)\/",  
               "incidentId":210546697,  
               "lane":"",  
               "lastModified":"\/Date(1309391096593)\/",  
               "roadClosed":true,  
               "severity":3,  
               "start":"\/Date(1307365200000)\/",  
               "type":9,  
               "verified":true  
            },  
            {  
               "__type":"TrafficIncident:http:\/\/schemas.microsoft.com\/search\/local\/ws\/rest\/v1",  
               "point":{  
                  "type":"Point",  
                  "coordinates":[  
                     38.85872,  
                     -94.54638
 
                  ]  
               },  
               "congestion":"",  
               "description":"Botts Rd is closed between Andrews Rd and 142nd St - construction",  
               "detour":"To go north take US-71 NB to 140th St and go west on 140th St to access Botts Rd- To go south continue west on MO-150 to Thunderbird Rd to 149th St",  
               "end":"\/Date(1315244760000)\/",  
               "incidentId":191097424,  
               "lane":"",  
               "lastModified":"\/Date(1309391096593)\/",  
               "roadClosed":true,  
               "severity":1,  
               "start":"\/Date(1295704800000)\/",  
               "type":9,  
               "verified":true


We’ve got two sets of coordinates here, so let’s take a look at what the Traffic API has to say about them. The “roadClosed” value being ‘true’ here lets us know that both locations have road closures. The ‘detour’ parameter also provides useful instructions on how to get around those closures.

Having a solution on hand is incredibly useful in practice. Let’s say you’ve got a reservation set up at a hotel and you’re trying to find a way to it along your route. The detour feature will make sure you get there despite closures and other incidents.

map showing new route with a coffee stop

What About Multiple Routes?

This particular example shows how useful Bing Maps API can be for finding gas and food along your route, but what happens when you’re a business trying to manage multiple agents on different routes? The Multi Itinerary API answers this question with a set of features that allows businesses to create optimized routes that save both time and money — even with multiple stops. Check out a demo to try it yourself!

So those are the basics! You could also use this feature if you’re in a hurry to a friend’s house and need to stop by the grocery store to grab a bottle of wine for the party. Or use it to find hotels along your route on those long, scenic road trips

Create a Bing Maps API key today and add extensive routing functionality to your app, backed by detailed developer documentation and support.

Try it out yourself and give us feedback. In the comments or in the Feedback form on the Bing Maps experience tell us what route you’re planning and if you found interesting things along the way!

For an introduction to planning your outing with Bing Maps, be sure to check out our post “Going out tonight? Plan it with Bing Maps Preview