URL Parameters for the Bing Maps website

The Bing Maps AJAX v7 API lets you create and embed a custom Bing Map in your own webpage containing Pushpins, LineStrings, and Polygons, custom overlays and specified map styles etc.

However, on many occasions you might not want, or need, to embed a map in your own site – you might be quite happy for your application to direct users to the webpage at www.bing.com/maps instead. In such cases, you generally want to load the www.bing.com/maps site to be centred on a particular location, with one or more locations highlighted on the map, or with a particular route highlighted.

Fortunately, all these can all be achieved by supplying parameters after the URL.

Unfortunately, the parameters that can be specified don’t seem to be documented anywhere. (Update: they are documented at http://onlinehelp.microsoft.com/en-us/bing/ff808440.aspx, but it seems pretty hard to find that page)

There are several old forum posts that refer to a page at http://help.live.com/Help.aspx?market=en-US&project=WL_Local&querytype=topic&query=WL_LOCAL_PROC_BuildURL.htm which apparently provided this information, but that page no longer seems to be available and I can’t find where, if at all, the information it used to contain is now published.

So, from my own memory, here’s a list of some useful parameters you can try passing to the page at http://www.bing.com/maps/default.aspx:

Parameter Example Description
cp cp=52.62~1.2 Centres the map on the specified latitude/longitude. Format for coordinates is lat~long
where1 where1=10 Downing Street, London, United Kingdom Centres the map on the specified address, and adds a default pushpin and infobox at that location.
sty sty=a Sets the map style. Valid values are:
r (road),
a (aerial),
h (hybrid = aerial with labels),
b (birdseye),
s (Ordnance Survey),
c (London Street Map)
lvl lvl=6 Sets the zoom level of the map (from 1, most zoomed out to 20 most zoomed in)
rtp rtp=pos.50_2~pos.48_5~pos.45_10~pos.52_14rtp=adr.Norwich,Norfolk~adr.Oxford,%20Oxon Sets the list of waypoints for a route to be displayed on the map. Each waypoint can either be specified as a latitude/longitude coordinate using the syntax pos.latitude_longitude, or an address using the syntax adr.street address.Individual waypoints are separated from each other with ~.

 

and here’s some examples:

Highlighting the address at 10 Downing Street, London on a London Street Map

http://www.bing.com/maps/default.aspx?where1=10 Downing Street, London&sty=c

image

Displaying the route from Norwich to Edinburgh via Oxford

http://www.bing.com/maps/default.aspx?rtp=adr.Norwich,Norfolk~adr.Oxford,%20Oxon~adr.Edinburgh,%20Scotland

image

 

Calculating a route between a set of lat/long coordinates and displaying that route on an aerial map

(route starts at (50,2), then goes through (48,5) and (45, 10) before ending at (52,14))

http://www.bing.com/maps/default.aspx?rtp=pos.50_2~pos.48_5~pos.45_10~pos.52_14&sty=a

image

 

Hope that helps someone!

About these ads
This entry was posted in Bing Maps and tagged . Bookmark the permalink.

4 Responses to URL Parameters for the Bing Maps website

  1. rbrundritt says:

    Official documentation for the URL parameters can be found here: http://onlinehelp.microsoft.com/en-us/bing/ff808440.aspx

  2. alastaira says:

    Thanks Ricky – may I suggest that you might want to do something to increase the visibility of that page?!! Even knowing that such features were possible, I couldn’t find that reference either by searching or by clicking through from the bing.com/maps site. (How *do* users currently find that page?) And I like to think I know my way around Bing maps more than the average user!
    (And it seems some users don’t even know these features are possible – see http://stackoverflow.com/questions/11104956/is-it-possible-to-pass-data-needed-for-driving-directions-to-the-bing-maps-websi )

    Also, you might want to set up a redirect from the old help.live.com page referenced in the post above, as that page does come up several times in search results, but leads nowhere.

  3. Adam says:

    To ask a dumb question, is there any way to pass a stored Bing maps url and get a small map returned? It would be exactly the same thing as going to share-embed and taking the embed code, but from a url.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s