Sunteți pe pagina 1din 453

Contents

Bing Maps REST Services .............................................................................................................. 3 Getting Started with the Bing Maps REST Services .................................................................... 4 What's New in the REST Services ............................................................................................... 5 Getting Traffic Incident Data ........................................................................................................ 6 Using the REST Services with .NET .......................................................................................... 11 Locations API ............................................................................................................................. 17 Find a Location by Address .................................................................................................... 17 Find a Location by Point ......................................................................................................... 33 Find a Location by Query ........................................................................................................ 43 Location Data .......................................................................................................................... 60 Elevations API ............................................................................................................................ 71 Get Elevations ......................................................................................................................... 72 Elevation Data......................................................................................................................... 86 Point Compression Algorithm ................................................................................................. 91 Imagery API................................................................................................................................ 97 Get a Static Map ..................................................................................................................... 97 Get Imagery Metadata .......................................................................................................... 121 Imagery Metadata ................................................................................................................. 133 Static Map Data .................................................................................................................... 138 Routes API ............................................................................................................................... 147 Calculate a Route ................................................................................................................. 148 Driving Route Example ...................................................................................................... 158 Walking Route Example .................................................................................................... 181 Transit Route Example ...................................................................................................... 213 Driving Route with Route Path Example ........................................................................... 240 Driving Route using Tolerances Example ......................................................................... 289 Calculate Routes from Major Roads ..................................................................................... 296 Route Data ............................................................................................................................ 336 Maneuver Types ................................................................................................................... 353 Warning Types ...................................................................................................................... 356 Traffic API ................................................................................................................................. 357 Get Traffic Incidents .............................................................................................................. 358 Traffic Incident Data .............................................................................................................. 369 Common Parameters and Types ............................................................................................. 376 Bing Maps REST URL Structure .......................................................................................... 376 Culture Parameter................................................................................................................. 378 Output Parameters................................................................................................................ 379 User Context Parameters ..................................................................................................... 382

Location and Area Types ...................................................................................................... 383 Pushpin Syntax and Icon Styles ........................................................................................... 385 Entity Types .......................................................................................................................... 398 Supported Culture Codes ..................................................................................................... 409 Common Response Description .............................................................................................. 414 JSON Data Contracts ............................................................................................................... 418 Status Codes and Error Handling ............................................................................................ 451 Developer Resources ............................................................................................................... 453

Bing Maps REST Services


The Bing Maps REST Services Application Programming Interface (API) provides a Representational State Transfer (REST) interface to perform tasks such as creating a static map with pushpins, geocoding an address, retrieving imagery metadata, or creating a route. Transaction accounting is provided when you use the Bing Maps REST Services. For more information about billable and non-billable transactions for the Bing Maps REST Services, see Viewing Bing Maps Transaction Reports. For information about geocoding large sets of spatial data using a REST Interface, see the Bing Spatial Data Services. If you are reading this documentation online, you can download the Bing Maps REST Services documentation CHM file or PDF file for offline viewing.

In This Section
Getting Started with the Bing Maps REST Services What's New in the REST Services Getting Traffic Incident Data Using the REST Services with .NET Locations API Elevations API Get started with the Bing Maps REST Services. Find out about the latest updates to the Bing Maps REST Services. Learn how to get traffic incident data by using the Routes API and the Traffic API. Use the article to learn how to interact with the Bing Maps REST Services APIs using .NET Use the Locations API to geocode and reversegeocode location data. Use the Elevations API to get elevation information for a set of locations, polyline or area on the Earth. Use the Imagery API to get a map with your specifications or if you want to request imagery data such as map tile URLs and imagery provider information. Use the Routes API to get directions and route information for driving, walking or using transit. Use the Traffic API to get information about
3

Imagery API

Routes API Traffic API

traffic incidents and issues in a specified area. Common Parameters and Types Common Response Description Use common parameters and types to specify values such as culture and pushpin styles. Use this description to understand the results returned for a Bing Maps REST Services request. Use the status and error code descriptions for troubleshooting. Resources and support for the Bing Maps REST Services.

Status Codes and Error Handling Developer Resources

See Also
Terms and Conditions

Getting Started with the Bing Maps REST Services


The Bing Maps REST Services Application Programming Interface (API) is a Representational State Transfer (REST) API that you can use to do common tasks, such as finding an address, retrieving a map with a pushpin and a label, or getting driving directions. You perform these tasks by constructing a URL.. To use the Bing Maps REST Services, you must have a Bing Maps Key.

Bing Maps REST Services


The following table lists the Bing Maps REST Services and the common tasks they perform. Click the links for API details.
REST API Features

Locations API Elevations API Imagery API

Find a location based on an address, point, or query. Get the elevations for a set of locations, a path, or an area on the Earth. Get a static map. Get a static map that displays a route. Get imagery metadata. Find a walking, driving or transit route. Find routes from major routes to a location.
4

Routes API

REST API

Features

Traffic API

Get traffic information along a route. Get traffic information for a geographical area.

Additional Topics
The following topics show examples of how to use the Bing Maps REST Services with other Bing Maps APIs or provide related information. Displaying Location Search Results Using the REST Services Accessing the Bing Maps REST Services using PHP Bing Maps Transit Coverage This topic shows how to use the Bing Maps REST Services with Bing Maps AJAX Control, Version 7.0. This article shows how to write a PHP application that can interact with the Bing Maps REST Services APIs. Provides a list of transit agencies that are used by Bing Maps REST Services to provide transit routes.

Transaction Accounting
Transactions are counted for each Bing Maps REST Services request sent with a valid Bing Maps Key. For information about billable and non-billable transactions for the Bing Maps REST Services, see Viewing Bing Maps Usage Reports.

What's New in the REST Services


The Bing Maps REST Services contains the following new features. NEW Elevations API [Get Elevations] This new API returns elevations for locations on the Earth. You can request elevations for: A set of locations. Locations along a polyline you define, such as the coordinates of a road or hiking trail. Locations within a rectangular area that is defined by pairs of latitudes and longitudes.

You can request elevations based on the ellipsoid model of the Earth (WGS84) or the geoid sea level mode (EGM2008 2.5). The ellipsoid model is equivalent to GPS altitude and the geoid sea level model is what is commonly known as altitude above sea level. For more information about these models, see the Earth Models and Zoom Level section in the Get Elevations topic. Expanded language coverage for Routes API and Locations API (Geocoding)
5

The Bing Maps REST Services has significantly expanded its language coverage when you geocode locations or create routes. For a list of supported language codes to use with the culture parameter, see Supported Culture Codes.

Getting Traffic Incident Data


You can get traffic incident information along a route using the Routes API and for a geographical area by using the Traffic API. Traffic incident information is provided in two ways: Traffic incident details including description, severity, location, type of incident. Traffic location codes that specify incident information for a road segment or specific location as a code, such as 120-15918. A subscription is typically required to interpret and use the traffic location codes.

For traffic coverage by country, see Bing Maps Traffic Coverage.

Traffic incident information along a route (Routes API)


Each route segment (itinerary item) returned by the Routes API may include a set of traffic location codes and a set of warnings that specify traffic incident information along that part of the route. The warnings include a description of the incident, the severity, and a warning type, such as Accident or BlockedRoad. To see a list of the warning types, see Warning Types. There is no specific correlation between traffic location codes and warnings. For example, an itinerary item can contain traffic location codes without corresponding warnings. The following is an example of an itinerary item that contains both warnings and traffic location codes.
{ "itineraryItems":[ { "compassDirection":"south", "details":[ { "compassDegrees":180, "endPathIndices":[ 1 ], "locationCodes":[ "114-08912", "114-08911" ], "maneuverType":"DepartStart", 6

"mode":"Driving", "names":[ "44TH Ave W" ], "roadType":"Arterial", "startPathIndices":[ 0 ] } ], "exit":"", "iconType":"Auto", "instruction":{ "maneuverType":"DepartStart", "text":"Depart 44TH Ave W toward 192ND St SW" }, "maneuverPoint":{ "type":"Point", "coordinates":[ 47.825321, -122.292407 ] }, "sideOfStreet":"Unknown", "tollZone":"", "towardsRoadName":"192ND St SW", "transitTerminus":"", "travelDistance":1.029, "travelDuration":97, "travelMode":"Driving" }, { "compassDirection":"southwest", "details":[ 7

{ "compassDegrees":217, "endPathIndices":[ 6 ], "maneuverType":"TakeRampRight", "mode":"Driving", "roadType":"Ramp", "startPathIndices":[ 1 ] }, { "compassDegrees":241, "endPathIndices":[ 91 ], "locationCodes":[ "114-04212", "114N04212", "114-04211", "114N04211", "114N04207", "114-04195" ], "maneuverType":"Merge", "mode":"Driving", "names":[ "I-5 South" ], "roadShieldRequestParameters":{ "bucket":50402, "shields":[ { 8

"labels":[ "5" ], "roadShieldType":1 } ] }, "roadType":"LimitedAccessHighway", "startPathIndices":[ 6 ] } ], "exit":"", "iconType":"Auto", "instruction":{ "maneuverType":"RampThenHighwayRight", "text":"Take ramp right for I-5 South" }, "maneuverPoint":{ "type":"Point", "coordinates":[ 47.816019, -122.292332 ] }, "sideOfStreet":"Unknown", "tollZone":"", "transitTerminus":"", "travelDistance":24.323, "travelDuration":908, "travelMode":"Driving", "warnings":[ { 9

"severity":"Minor", "text":"Minor Congestion: slow 1st Av\/Northgate Way (#173) to Express Lanes Southern Entrance\/Exit", "warningType":"Congestion" } ] } ] }

Traffic incident information within a geographical area (Traffic API)


The Traffic API returns a list of traffic incidents in a geographical area and provides incident details and traffic location codes. Traffic incident details include information such as the incident description, severity, location, road closures, type of incident, time of incident and detours. See Traffic Incident Data for a list of the incident details that may be returned. Traffic incidents reported by the Traffic API include common traffic problems, such as accidents and disabled vehicles, as well as other potential causes of traffic, such as sports events. To use the Traffic API, you must specify an area defined as a bounding box. A bounding box is a set of longitudes and latitudes that define an area. See Location and Area Types for more information about a bounding box. The following is an example of traffic incident information returned in a JSON Traffic API response.
{

"__type":"TrafficIncident:http:\/\/schemas.microsoft.com\/search\/local\/ws\/rest\/v1", "point":{ "type":"Point", "coordinates":[ 38.64829, -94.36405 ] }, "congestion":"", "description":"in both directions between MO-2\/MO-7 and MO-291\/Cantrell Rd construction",

10

"detour":"", "end":"\/Date(1316217600000)\/", "incidentId":214828828, "lane":"Total Lanes lane blocked", "lastModified":"\/Date(1310385750290)\/", "roadClosed":false, "severity":2, "start":"\/Date(1310126400000)\/", "toPoint":{ "type":"Point", "coordinates":[ 38.65831, -94.36706 ] }, "locationCodes":[ "119+05041", "119+05042", "119-05041", "119-05042", "119N05041", "119N05042", "119P05041", "119P05042" ], "type":9, "verified":true }

Using the REST Services with .NET


This article will describe how to interact with the Bing Maps REST Services APIs using .NET. This approach can be used with technologies such as Windows Store apps and Windows Presentation Foundation (WPF).
11

The Bing Maps REST Services are a set of RESTful web services that access collection of resources by using a URL and the HTTP GET and POST methods The size of REST responses tend to be significantly smaller than SOAP-based service responses, and reduce the amount of time it takes a client application to download the response data. This increase in efficiency becomes especially important when developing mobile applications. Each Bing Maps REST Services request is made using a URI and additional query parameters that specify the information to return. Some REST Services APIs support HTTP POST requests that you can use when the query parameter data increases the URL length beyond browser limits. You can specify XML or JSON format for the response. A JSON response is typically 25%40% smaller than an XML response, and will take less time for the client to download. This topic focuses on JSON responses only.

Making use of sessions


All Bing Maps REST Services require a Bing Maps Key. If you are using the Bing Maps REST Services with one of the Bing Maps controls, such as AJAX, WPF, Windows Store app SDK, you can use a Bing Maps key as a session key. A session key can be used for all requests to the Bing Maps REST Services. The benefit of using a session key is that you are billed for one transaction per session and all calls to the REST services within that session are non-billable. For more information about billed transactions, see Viewing Bing Maps Usage Reports. The following examples show how to create a session key from an instance of Bing Maps control using .NET.
Map.CredentialsProvider.GetCredentials((c) => { string sessionKey = c.ApplicationId;

//Generate a request URL for the Bing Maps REST services. //Use the session key in the request as the Bing Maps key }); Map.CredentialsProvider.GetCredentials( Function(c) Dim sessionKey As String = c.ApplicationId 'Generate a request URL for the Bing Maps REST services. 'Use the session key in the request as the Bing Maps key Return 0 End Function)

12

Making the request


To access the Bing Maps REST Services, you create a URL request and then submit the request using HTTP GET or POST protocol . When the response data is returned, you must serialize the data against a set of data contracts. The data contracts for the Bing Maps REST Services are quite large and have been included at the end of this topic. As the Bing Maps REST Services adds new functionality, these data contracts must be updated. A benefit of working with JSON serialization rather than XML serialization is that changes in the schema rarely cause issues for existing applications. For instance, if a new property is added to the Bing Maps REST Services, an application that uses the old data contracts can still process a response without errors; however, the new property will not be available. To get the new property, you must update the data contracts. In order to make use of JSON serialization in .NET, use the DataContractJsonSerializer by referencing the following libraries in your project: System.Runtime.Serialization System.ServiceModel.Web

When you specify parameter data for a Bing Maps REST service request, it is a good practice to encode the parameter values. This becomes especially important when working with special characters. In the following code samples, we use the Uri class that encodes these parameters automatically.

HTTP GET Requests


The following example is a generic method that can be used to make GET requests with Bing Maps REST Services.
private void GetResponse(Uri uri, Action<Response> callback) { WebClient wc = new WebClient(); wc.OpenReadCompleted += (o, a) => { if (callback != null) { DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(Response)); callback(ser.ReadObject(a.Result) as Response); } }; wc.OpenReadAsync(uri); } Private Sub GetResponse(uri As Uri, callback As Action(Of Response)) 13

Dim wc As New WebClient() AddHandler wc.OpenReadCompleted, Function(o, a) If callback IsNot Nothing Then Dim ser As New DataContractJsonSerializer(GetType(Response)) callback(TryCast(ser.ReadObject(a.Result), Response)) End If Return 0 End Function wc.OpenReadAsync(uri) End Sub

HTTP POST Requests


The following example is a generic method that can be used to make HTTP POST requests with Bing Maps REST Services for APIs that support HTTP POST protocol.
private void GetPOSTResponse(Uri uri, string data, Action<Response> callback) { HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(uri);

request.Method = "POST"; request.ContentType = "text/plain;charset=utf-8";

System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding(); byte[] bytes = encoding.GetBytes(data);

request.ContentLength = bytes.Length;

using (Stream requestStream = request.GetRequestStream()) { // Send the data. requestStream.Write(bytes, 0, bytes.Length); }

request.BeginGetResponse((x) =>

14

{ using (HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(x)) { if (callback != null) { DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(Response)); callback(ser.ReadObject(response.GetResponseStream()) as Response); } } }, null); } Private Sub GetPOSTResponse(uri As Uri, data As String, callback As Action(Of Response)) Dim request As HttpWebRequest = DirectCast(HttpWebRequest.Create(uri), HttpWebRequest)

request.Method = "POST" request.ContentType = "text/plain;charset=utf-8"

Dim encoding As New System.Text.UTF8Encoding() Dim bytes As Byte() = encoding.GetBytes(data)

request.ContentLength = bytes.Length

Using requestStream As Stream = request.GetRequestStream() ' Send the data. requestStream.Write(bytes, 0, bytes.Length) End Using

request.BeginGetResponse( Function(x) Using response As HttpWebResponse = DirectCast(request.EndGetResponse(x), HttpWebResponse) If callback IsNot Nothing Then

15

Dim ser As New DataContractJsonSerializer(GetType(Response)) callback(TryCast(ser.ReadObject(response.GetResponseStream()), Response)) End If End Using Return 0 End Function, Nothing) End Sub

Implementing a request
The following is an example of how to use the above generic methods to make an HTTP GET request to the Bing Maps REST Services. This example geocodes the address 1 Microsoft Way, Redmond, WA.
string key = "YOUR_BING_MAPS_KEY or SESSION_KEY"; string query = "1 Microsoft Way, Redmond, WA";

Uri geocodeRequest = new Uri(string.Format("http://dev.virtualearth.net/REST/v1/Locations?q={0}&key={1}", query, key));

GetResponse(geocodeRequest, (x) => { Console.WriteLine(x.ResourceSets[0].Resources.Length + " result(s) found."); Console.ReadLine(); }); Dim key As String = "YOUR_BING_MAPS_KEY or SESSION_KEY" Dim query As String = "1 Microsoft Way, Redmond, WA"

Dim geocodeRequest As New Uri(String.Format("http://dev.virtualearth.net/REST/v1/Locations?q={0}&key={1}", query, key))

GetResponse(geocodeRequest, Function(x) Console.WriteLine(x.ResourceSets(0).Resources.Length + " result(s) found.") Console.ReadLine()

16

Return 0 End Function)

Data Contracts
The data contracts for the Bing Maps REST Services are large but straight forward. All classes need to have a DataContract attribute, and all public properties that are to be serialized need to have a DataMember attribute, and both a getter and a setter in C#. See JSON Data Contracts for the latest set of contracts.

Locations API
Use the Locations API to get location information. For an example of how to use the Locations API with Bing Maps AJAX Control 7.0, see Displaying Location Search Results Using the REST Services.

In this section
Find a Location by Address Use these URL templates to get latitude and longitude coordinates for a location by specifying values such as a locality, postal code, and street address. Use this URL template to get the location information associated with latitude and longitude coordinates. Use these URL templates to get latitude and longitude coordinates that correspond to location information provided as a query string. Use this description to understand the results returned in the response to a Locations API request.

Find a Location by Point

Find a Location by Query

Location Data

See Also
Displaying Location Search Results Using the REST Services and the AJAX 7 Control Show Bing Results on a Map

Find a Location by Address


Use the following URL templates to get latitude and longitude coordinates for a location by specifying values such as a locality, postal code, and street address.
17

When you make a request by using one of the following URL templates, the response returns one or more Location resources that contain location information associated with the URL parameter values. The location information for each resource includes latitude and longitude coordinates, the type of location, and the geographical area that contains the location. For more information about the Location resource, see Location Data. You can also view the example URL and response values in the Examples section.

URL Templates
These templates support both HTTP and HTTPS protocols.

You can increase the accuracy of a location result by specifying an IP address, user location or map area in the URL request. For more information about these parameters, see User Context Parameters. Structured URLs: Get the latitude and longitude coordinates based on a set of address values for specific countries

You can substitute a hyphen (-) for any structured URL parameter when there is no value. For countries that do not have a structured URL template, use the Unstructured URL described below. A structured URL specifies the location data for the country as part of the URL path. Canada
http://dev.virtualearth.net/REST/v1/Locations/CA/adminDistrict/postalCode/locality/addres sLine?includeNeighborhood=includeNeighborhood&maxResults=maxResults&key=BingMapsKey

France
http://dev.virtualearth.net/REST/v1/Locations/FR/postalCode/locality/addressLine?includeN eighborhood=includeNeighborhood&maxResults=maxResults&key=BingMapsKey

Germany
http://dev.virtualearth.net/REST/v1/Locations/DE/postalCode/locality/addressLine?includeN eighborhood=includeNeighborhood&maxResults=maxResults&key=BingMapsKey

United Kingdom
http://dev.virtualearth.net/REST/v1/Locations/UK/postalCode?includeNeighborhood=includeNe ighborhood&maxResults=maxResults&key=BingMapsKey

United States
http://dev.virtualearth.net/REST/v1/Locations/US/adminDistrict/postalCode/locality/addres sLine?includeNeighborhood=includeNeighborhood&maxResults=maxResults&key=BingMapsKey 18

http://dev.virtualearth.net/REST/v1/Locations/US/adminDistrict/locality/addressLine?inclu deNeighborhood=includeNeighborhood&maxResults=maxResults&key=BingMapsKey

Unstructured URL: Get the latitude and longitude coordinates based on a set of address values for any country You can get information for a location in any country by setting one or more of the parameters in the following URL. An unstructured URL appends the location data to the URL path. In the URL below, address information is specified by using URL address parameters such as addressLine, adminDistrict. and postalCode. These parameters are appended to the URL path.
http://dev.virtualearth.net/REST/v1/Locations?countryRegion=countryRegion&adminDistrict=a dminDistrict&locality=locality&postalCode=postalCode&addressLine=addressLine&userLocation =userLocation&userIp=userIp&usermapView=usermapView&includeNeighborhood=includeNeighborho od&maxResults=maxResults&key=BingMapsKey

About Special Characters When you specify location information using one of the structured URLs, do not use values that contain special characters such as a period (.), a comma (,), a colon (:) or a plus sign (+). A hyphen is acceptable as a placeholder, but should not be used as part of a parameter value in a structured URL. If the location information contains any special characters, use the Unstructured URL template or the Find a Location by Query API. For example, if you want to get latitude and longitude values for the address "100 Main St. Somewhere, WA 98001" that contains a period (.), use one of the following query formats. Unstructured query:
http://dev.virtualearth.net/REST/v1/Locations?CountryRegion=US&adminDistrict=WA&lo cality=Somewhere&postalCode=98001&addressLine=100%20Main%20St.&key=BingMapsKey

Find a Location by Query query:


http://dev.virtualearth.net/REST/v1/Locations?q=100%20Main%20St.%20Somewhere,%20WA %2098001&key=BingMapsKey

You can increase the accuracy of a location result by specifying an IP address, user location or map area in the URL request. For more information about these parameters, see User Context Parameters. If you are using the Locations API from server-side code, you can set the userIP parameter to 127.0.0.1 (localhost) to prevent the servers location from affecting the location search results. Template Parameters

19

See the Common Parameters and Types section for additional common parameters to use with these URLs. Common parameters include: Output Parameters: Includes response output types and the JSON callback parameters. Culture Parameter: Includes a list of the supported cultures. User Context Parameters: Includes parameters that set user location and viewport values to help with determining locations. For example, you can specify the users location to prioritize the set of locations returned when you query with incomplete address information. Parameter values are not case-sensitive.
Parameters Alias Description Values

adminDistrict

Optional for unstructured URL. The subdivision name in the country or region for an address. This element is typically treated as the first order administrative subdivision, but in some cases it is the second, third, or fourth order subdivision in a country, dependency, or region. Optional for unstructured URL. The locality, such as the city or neighborhood, that corresponds to an address. Optional for unstructured URL. The post code, postal code, or ZIP Code of an address. Optional for unstructured URL. The official street line of an address relative to the area, as specified by the Locality, or PostalCode, properties. Typical use of this element would be to provide a

A string that contains a subdivision, such as the abbreviation of a US state. Example: WA

locality

A string that contains the locality, such as a US city. Example: Seattle A string that contains the postal code, such as a US ZIP Code. Example: 98178 A string specifying the street line of an address. Example: 1 Microsoft Way

postalCode

addressLine

20

Parameters

Alias

Description

Values

street address or any official address. countryRegion Optional for unstructured A string specifying URL. The ISO country the ISO country code. code for the country. Example: AU inclnb Optional. Specifies to include the neighborhood in the response when it is available. One of the following values: 1: Include neighborhood information when available. 0 [default]: Do not include neighborhood information. Example: inclnb=1

includeNeighborhood

When you create your URL request, you can set the Locality parameter to a neighborhood. In this case, the neighborhood you provide may be returned in the neighborhood field of the response and a greater locality may be returned in the locality field. For example, you can create a request that specifies to include neighborhood information (inclnb=1) and that sets the Locality to Ballard and the AdminDistrict to WA (Washington State). In this case, the neighborhood field in the

21

Parameters

Alias

Description

Values

response is set to Ballard and the locality field is set to Seattle. You can find this example in the Examples section. maxResults maxRes Optional. Specifies the maximum number of locations to return in the response. A string that contains an integer between 1 and 20. The default value is 5. Example: maxResults=10

Response
One or more Location resources are returned in the response when you make a request by using these URL templates. For more information about the Location resource, see Location Data. For more information about the common response syntax for the Bing Maps REST Services, see Common Response Description. Responses are provided for some URL examples in the following section. These URLs support JSON (application/json) and XML (application/xml) response formats. A JSON response is provided by default unless you request XML output by setting the output (o) parameter. For more information, see Output Parameters.

Examples

Find location information for a United States street address including the ZIP Code. This example provides location information for a street address in the United States and requests the results in XML format.
http://dev.virtualearth.net/REST/v1/Locations/US/WA/98052/Redmond/1%20Microsoft%20Way?o=x ml&key=BingMapsKey

XML Response The Locations resource returned for this example provides the latitude and longitude of the location and defines a geographical area (bounding box) that includes the location. The location entity type is defined as an Address and the address information that was used as input parameters is included and enhanced by adding the county (AdminDistrict2) and ZIP Code.
22

<Response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/search/local/ws/rest/v1"> <Copyright> Copyright 2011 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation. </Copyright> <BrandLogoUri> http://dev.virtualearth.net/Branding/logo_powered_by.png </BrandLogoUri> <StatusCode>200</StatusCode> <StatusDescription>OK</StatusDescription> <AuthenticationResultCode>ValidCredentials</AuthenticationResultCode> <TraceId> 558732d648204c958546678579cbc5cb </TraceId> <ResourceSets> <ResourceSet> <EstimatedTotal>1</EstimatedTotal> <Resources> <Location> <Name>1 Microsoft Way, Redmond, WA 98052</Name> <Point> <Latitude>47.640120461583138</Latitude> <Longitude>-122.12971039116383</Longitude> </Point> <BoundingBox> <SouthLatitude>47.636257744012461</SouthLatitude> <WestLongitude>-122.13735364288299</WestLongitude> <NorthLatitude>47.643983179153814</NorthLatitude> <EastLongitude>-122.12206713944467</EastLongitude> </BoundingBox> <EntityType>Address</EntityType>

23

<Address> <AddressLine>1 Microsoft Way</AddressLine> <AdminDistrict>WA</AdminDistrict> <AdminDistrict2>King Co.</AdminDistrict2> <CountryRegion>United States</CountryRegion> <FormattedAddress>1 Microsoft Way, Redmond, WA 98052</FormattedAddress> <Locality>Redmond</Locality> <PostalCode>98052</PostalCode> </Address> <Confidence>High</Confidence> <MatchCode>Good</MatchCode> <GeocodePoint> <Latitude>47.640120461583138</Latitude> <Longitude>-122.12971039116383</Longitude> <CalculationMethod>InterpolationOffset</CalculationMethod> <UsageType>Display</UsageType> </GeocodePoint> <GeocodePoint> <Latitude>47.640144601464272</Latitude> <Longitude>-122.12976671755314</Longitude> <CalculationMethod>Interpolation</CalculationMethod> <UsageType>Route</UsageType> </GeocodePoint> </Location> </Resources> </ResourceSet> </ResourceSets> </Response>

JSON Response The following JSON response contains the same information as the previous XML response and is provided when the output (o) parameter is not set.
{ "authenticationResultCode":"ValidCredentials", 24

"brandLogoUri":"http:\/\/dev.virtualearth.net\/Branding\/logo_powered_by.png", "copyright":"Copyright 2011 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.", "resourceSets":[ { "estimatedTotal":1, "resources":[ {

"__type":"Location:http:\/\/schemas.microsoft.com\/search\/local\/ws\/rest\/v1", "bbox":[ 47.636257744012461, -122.13735364288299, 47.643983179153814, -122.12206713944467 ], "name":"1 Microsoft Way, Redmond, WA 98052", "point":{ "type":"Point", "coordinates":[ 47.640120461583138, -122.12971039116383 ] }, "address":{ "addressLine":"1 Microsoft Way", "adminDistrict":"WA", "adminDistrict2":"King Co.", "countryRegion":"United States", "formattedAddress":"1 Microsoft Way, Redmond, WA 98052", "locality":"Redmond", "postalCode":"98052"

25

}, "confidence":"High", "entityType":"Address", "geocodePoints":[ { "type":"Point", "coordinates":[ 47.640120461583138, -122.12971039116383 ], "calculationMethod":"InterpolationOffset", "usageTypes":[ "Display" ] }, { "type":"Point", "coordinates":[ 47.640144601464272, -122.12976671755314 ], "calculationMethod":"Interpolation", "usageTypes":[ "Route" ] } ], "matchCodes":[ "Good" ] } ] } ], 26

"statusCode":200, "statusDescription":"OK", "traceId":"b0b1286504404eafa7e7dad3e749d570" }

Find location information for a United States street address without a postal code. This example provides location information for the same street address as the previous example, but does not specify the ZIP Code.
http://dev.virtualearth.net/REST/v1/Locations/US/WA/Redmond/1%20Microsoft%20Way?output=xm l&key=BingMapsKey

Find location information and request up to 10 location results in the response. This example provides location information for the locality "Greenville" and requests up to 10 location results in the response. The default maximum number of locations returned is five (5) results.
http://dev.virtualearth.net/REST/v1/Locations?locality=Greenville&maxResults=10&key=BingM apsKey

Find location information by using a structured URL where some parameters have no value. This example provides location information for the United States and uses hyphens (-) for address values that are not specified.
http://dev.virtualearth.net/REST/v1/Locations/US/-/-/-?key=BingMapsKey

Find location information by using an unstructured URL and setting the userLocation parameter. This example provides location information for an unstructured query for Kings Road in the United Kingdom and uses the userLocation value to prioritize the response. If you remove the userLocation parameter in this example, the results change because the userLocation position
27

prioritizes results that are closer to this location. For more information about the userLocation parameter and other user context parameters, see User Context Parameters.
http://dev.virtualearth.net/REST/v1/Locations?culture=enGB&addressLine=Kings%20Road&o=xml&userLocation=51.504360719046616,0.12600176611298197&key=BingMapsKey

Find location information and request neighborhood information in the response. This example provides location information for Ballard in Washington state (WA) and also returns neighborhood information. Ballard is a neighborhood, but is specified as a locality in the request. Note that in the response, Ballard is defined as the neighborhood and Seattle is defined as the locality.
http://dev.virtualearth.net/REST/v1/Locations/US/WA/-/Ballard/?o=xml&inclnb=1&key=BingMapsKey

XML Response
<Response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/search/local/ws/rest/v1"> <Copyright> Copyright 2011 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation. </Copyright> <BrandLogoUri> http://dev.virtualearth.net/Branding/logo_powered_by.png </BrandLogoUri> <StatusCode>200</StatusCode> <StatusDescription>OK</StatusDescription> <AuthenticationResultCode>ValidCredentials</AuthenticationResultCode> <TraceId> ce2998ccf7dc4985b689b091fb64b3e5 </TraceId> <ResourceSets> <ResourceSet> <EstimatedTotal>1</EstimatedTotal> <Resources> 28

<Location> <Name>Ballard, WA</Name> <Point> <Latitude>47.675968170166016</Latitude> <Longitude>-122.38591003417969</Longitude> </Point> <BoundingBox> <SouthLatitude>47.6561164855957</SouthLatitude> <WestLongitude>-122.41252899169922</WestLongitude> <NorthLatitude>47.697746276855469</NorthLatitude> <EastLongitude>-122.36044311523438</EastLongitude> </BoundingBox> <EntityType>Neighborhood</EntityType> <Address> <AdminDistrict>WA</AdminDistrict> <AdminDistrict2>King Co.</AdminDistrict2> <CountryRegion>United States</CountryRegion> <FormattedAddress>Ballard, WA</FormattedAddress> <Locality>Seattle</Locality> <Neighborhood>Ballard</Neighborhood> </Address> <Confidence>High</Confidence> <MatchCode>Good</MatchCode> <GeocodePoint> <Latitude>47.675968170166016</Latitude> <Longitude>-122.38591003417969</Longitude> <CalculationMethod>Rooftop</CalculationMethod> <UsageType>Display</UsageType> </GeocodePoint> </Location> </Resources> </ResourceSet> </ResourceSets> </Response> 29

JSON Response The following JSON response contains the same information as the previous XML response and is provided when the output (o) parameter is not set.
{ "authenticationResultCode":"ValidCredentials", "brandLogoUri":"http:\/\/dev.virtualearth.net\/Branding\/logo_powered_by.png", "copyright":"Copyright 2011 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.", "resourceSets":[ { "estimatedTotal":1, "resources":[ {

"__type":"Location:http:\/\/schemas.microsoft.com\/search\/local\/ws\/rest\/v1", "bbox":[ 47.6561164855957, -122.41252899169922, 47.697746276855469, -122.36044311523438 ], "name":"Ballard, WA", "point":{ "type":"Point", "coordinates":[ 47.675968170166016, -122.38591003417969 ] }, "address":{ "adminDistrict":"WA", "adminDistrict2":"King Co.", 30

"countryRegion":"United States", "formattedAddress":"Ballard, WA", "locality":"Seattle", "neighborhood":"Ballard" }, "confidence":"High", "entityType":"Neighborhood", "geocodePoints":[ { "type":"Point", "coordinates":[ 47.675968170166016, -122.38591003417969 ], "calculationMethod":"Rooftop", "usageTypes":[ "Display" ] } ], "matchCodes":[ "Good" ] } ] } ], "statusCode":200, "statusDescription":"OK", "traceId":"0fa6626c9aae482e968c45e465862f93" }

Find location information for Canada. This example provides location information for a street in Vancouver, Canada.

31

http://dev.virtualearth.net/REST/v1/Locations/CA/BC/V6G/Vancouver/Stanley%20Park%20Causew ay?key=BingMapsKey

Find location information for France. This example provides location information for a street in Paris, France.
http://dev.virtualearth.net/REST/v1/Locations/FR/75007/Paris/Avenue%20Gustave%20Eiffel?ke y=BingMapsKey

Find location information for Germany. This example provides location information for an address in Berlin, Germany.
http://dev.virtualearth.net/REST/v1/Locations/DE/12010/Berlin/Platz%20Der%20Luftbrcke%20 5?key=BingMapsKey

Find location information for the United Kingdom. These examples provide location information for a postal code in the United Kingdom.
http://dev.virtualearth.net/REST/v1/Locations/GB/SW1A?key=BingMapsKey http://dev.virtualearth.net/REST/v1/Locations/GB/SW1A%202AA?key=BingMapsKey

Find location information by using an unstructured URL. These examples provide location information based on the specified parameter values.
http://dev.virtualearth.net/REST/v1/Locations?postalCode=98052&key=BingMapsKey http://dev.virtualearth.net/REST/v1/Locations?locality=Redmond&adminDistrict=WA&key=BingM apsKey http://dev.virtualearth.net/REST/v1/Locations?countryRegion=AU&adminDistrict=WA&key=BingM apsKey http://dev.virtualearth.net/REST/v1/Locations?locality=London&postalCode=SW1A&key=BingMap sKey

HTTP Status Codes


For more details about these HTTP status codes, see Status Codes and Error Handling.
32

When the request is successful, the following HTTP status code is returned. 200 400 401 500 503 When the request is not successful, the response returns one of the following errors.

Find a Location by Point


Use the following URL template to get the location information associated with latitude and longitude coordinates. When you make a request by using the following URL template, the response returns one or more Location resources that contain location information associated with the latitude and longitude coordinate values that you specify. Location information can be as specific as an address or more general such as the country or region. You can specify the type of location information you want to receive by setting the includeEntityTypes parameter in the URL. For example, you can specify to only receive information about the neighborhood that corresponds to the coordinates. For more information about the Location resource, see Location Data. You can also view the example URL and response values in the Examples section.

URL Template
This template supports both HTTP and HTTPS protocols. Get an address for a specified point (latitude and longitude).
http://dev.virtualearth.net/REST/v1/Locations/point?includeEntityTypes=entityTypes&includ eNeighborhood=includeNeighborhood&key=BingMapsKey

Template Parameters

See the Common Parameters and Types section for additional common parameters to use with these URLs. Common parameters include: Output Parameters: Includes response output types and the JSON callback parameters. Culture Parameter: Includes a list of the supported cultures. Parameter values are not case-sensitive.
Parameters Alias Description Values

includeEntityTypes

Optional.

A comma separated
33

Parameters

Alias

Description

Values

Specifies the entity types that you want to return in the response. Only the types you specify will be returned. If the point cannot be mapped to the entity types you specify, no location information is returned in the response.

list of entity types selected from the following options. Address Neighborhood PopulatedPlace Postcode1 AdminDivision1 AdminDivision2 CountryRegion

These entity types are ordered from the most specific entity to the least specific entity. When entities of more than one entity type are found, only the most specific entity is returned. For example, if you specify Address and AdminDistrict1 as entity types and entities were found for both types, only the Address entity information is returned in the response. One exception to this rule is when both PopulatedPlace and Neighborhood entity types are specified and information is found for both. In this case, the information for both entity types is returned. Also, more than one
34

Parameters

Alias

Description

Values

Neighborhood may be returned because the area covered by two different neighborhoods can overlap. point Required. The coordinates of the location that you want to reverse geocode. A point is specified by a latitude and a longitude. For more information, see the definition of Point in Location and Area Types. inclnb Optional. Specifies to include the neighborhood in the response when it is available. A point on the Earth specified by a latitude and longitude. For more information, see the definition of Point in Location and Area Types. Example: 47.64054,122.12934

includeNeighborhood

One of the following values: 1: Include neighborhood information when available. 0 [default]: Do not include neighborhood information. Example: inclnb=1

Response
One or more Location resources are returned in the response when you make a request using this URL template. For more information about the Location resource, see Location Data. For more information about the common response syntax for the Bing Maps REST Services, see Common Response Description. JSON and XML responses are provided for the URL example in the following section.

35

This URL supports JSON (application/json) and XML (application/xml) response formats. A JSON response is provided by default unless you request XML output by setting the output (o) parameter. For more information, see Output Parameters.

Examples
Find location information for a specified point on the Earth. This example gets address information for a specified latitude and longitude and requests the results in XML format.
http://dev.virtualearth.net/REST/v1/Locations/47.64054,-122.12934?o=xml&key=BingMapsKey

XML Response This example returns the following XML response.


<Response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/search/local/ws/rest/v1"> <Copyright> Copyright 2011 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation. </Copyright> <BrandLogoUri> http://dev.virtualearth.net/Branding/logo_powered_by.png </BrandLogoUri> <StatusCode>200</StatusCode> <StatusDescription>OK</StatusDescription> <AuthenticationResultCode>ValidCredentials</AuthenticationResultCode> <TraceId> dd31ffaf098f4406b7ecdd0da36680ff </TraceId> <ResourceSets> <ResourceSet> <EstimatedTotal>1</EstimatedTotal> <Resources> <Location> <Name>1 Microsoft Way, Redmond, WA 98052</Name> <Point> <Latitude>47.640568390488625</Latitude> 36

<Longitude>-122.1293731033802</Longitude> </Point> <BoundingBox> <SouthLatitude>47.636705672917948</SouthLatitude> <WestLongitude>-122.137016420622</WestLongitude> <NorthLatitude>47.6444311080593</NorthLatitude> <EastLongitude>-122.1217297861384</EastLongitude> </BoundingBox> <EntityType>Address</EntityType> <Address> <AddressLine>1 Microsoft Way</AddressLine> <AdminDistrict>WA</AdminDistrict> <AdminDistrict2>King Co.</AdminDistrict2> <CountryRegion>United States</CountryRegion> <FormattedAddress>1 Microsoft Way, Redmond, WA 98052</FormattedAddress> <Locality>Redmond</Locality> <PostalCode>98052</PostalCode> </Address> <Confidence>Medium</Confidence> <MatchCode>Good</MatchCode> <GeocodePoint> <Latitude>47.640568390488625</Latitude> <Longitude>-122.1293731033802</Longitude> <CalculationMethod>Interpolation</CalculationMethod> <UsageType>Display</UsageType> <UsageType>Route</UsageType> </GeocodePoint> </Location> </Resources> </ResourceSet> </ResourceSets> </Response>

JSON Response
37

The following JSON response contains the same information as the XML response and is provided when the output (o) parameter is not set.
{ "authenticationResultCode":"ValidCredentials", "brandLogoUri":"http:\/\/dev.virtualearth.net\/Branding\/logo_powered_by.png", "copyright":"Copyright 2011 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.", "resourceSets":[ { "estimatedTotal":1, "resources":[ {

"__type":"Location:http:\/\/schemas.microsoft.com\/search\/local\/ws\/rest\/v1", "bbox":[ 47.636705672917948, -122.137016420622, 47.6444311080593, -122.1217297861384 ], "name":"1 Microsoft Way, Redmond, WA 98052", "point":{ "type":"Point", "coordinates":[ 47.640568390488625, -122.1293731033802 ] }, "address":{ "addressLine":"1 Microsoft Way", "adminDistrict":"WA", "adminDistrict2":"King Co.", "countryRegion":"United States", 38

"formattedAddress":"1 Microsoft Way, Redmond, WA 98052", "locality":"Redmond", "postalCode":"98052" }, "confidence":"Medium", "entityType":"Address", "geocodePoints":[ { "type":"Point", "coordinates":[ 47.640568390488625, -122.1293731033802 ], "calculationMethod":"Interpolation", "usageTypes":[ "Display", "Route" ] } ], "matchCodes":[ "Good" ] } ] } ], "statusCode":200, "statusDescription":"OK", "traceId":"99b1256e09044490bce82bbbba1dab7a" }

Find location information for a specified point and request that only CountryRegion entity types be returned.

39

This example requests only country or region information for the same latitude and longitude as the previous example.
http://dev.virtualearth.net/REST/v1/Locations/47.64054,122.12934?includeEntityTypes=countryRegion&o=xml&key=BingMapsKey

XML Response This example returns the following XML response.


<Response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/search/local/ws/rest/v1"> <Copyright> Copyright 2011 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation. </Copyright> <BrandLogoUri> http://dev.virtualearth.net/Branding/logo_powered_by.png </BrandLogoUri> <StatusCode>200</StatusCode> <StatusDescription>OK</StatusDescription> <AuthenticationResultCode>ValidCredentials</AuthenticationResultCode> <TraceId> ca4cc0ce946e4564a20a44db811ee954 </TraceId> <ResourceSets> <ResourceSet> <EstimatedTotal>1</EstimatedTotal> <Resources> <Location> <Name>United States</Name> <Point> <Latitude>39.450000762939453</Latitude> <Longitude>-98.907997131347656</Longitude> </Point> <BoundingBox> <SouthLatitude>26.677207946777344</SouthLatitude> 40

<WestLongitude>177.3487548828125</WestLongitude> <NorthLatitude>75.7627944946289</NorthLatitude> <EastLongitude>-55.848747253417969</EastLongitude> </BoundingBox> <EntityType>Sovereign</EntityType> <Address> <CountryRegion>United States</CountryRegion> <FormattedAddress>United States</FormattedAddress> </Address> <Confidence>High</Confidence> <MatchCode>Good</MatchCode> <GeocodePoint> <Latitude>39.450000762939453</Latitude> <Longitude>-98.907997131347656</Longitude> <CalculationMethod>Rooftop</CalculationMethod> <UsageType>Display</UsageType> </GeocodePoint> </Location> </Resources> </ResourceSet> </ResourceSets> </Response>

JSON Response The following JSON response contains the same information as the XML response and is provided when the output (o) parameter is not set.
{ "authenticationResultCode":"ValidCredentials", "brandLogoUri":"http:\/\/dev.virtualearth.net\/Branding\/logo_powered_by.png", "copyright":"Copyright 2011 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.", "resourceSets":[ { 41

"estimatedTotal":1, "resources":[ {

"__type":"Location:http:\/\/schemas.microsoft.com\/search\/local\/ws\/rest\/v1", "bbox":[ 26.677207946777344, 177.3487548828125, 75.7627944946289, -55.848747253417969 ], "name":"United States", "point":{ "type":"Point", "coordinates":[ 39.450000762939453, -98.907997131347656 ] }, "address":{ "countryRegion":"United States", "formattedAddress":"United States" }, "confidence":"High", "entityType":"Sovereign", "geocodePoints":[ { "type":"Point", "coordinates":[ 39.450000762939453, -98.907997131347656 ], "calculationMethod":"Rooftop", "usageTypes":[ 42

"Display" ] } ], "matchCodes":[ "Good" ] } ] } ], "statusCode":200, "statusDescription":"OK", "traceId":"df80a942ddb3440188d7f97a31979d1a" }

HTTP Status Codes


For more details about these HTTP status codes, see Status Codes and Error Handling. When the request is successful, the following HTTP status code is returned. 200 400 401 500 503 When the request is not successful, the response returns one of the following errors.

See Also
Displaying Location Search Results Using the REST Services and the AJAX 7 Control

Find a Location by Query


Use the following URL templates to get latitude and longitude coordinates that correspond to location information provided as a query string. The strings Space Needle (a landmark) and 1 Microsoft Way Redmond WA (an address) are examples of query strings with location information. These strings can be specified as a structured URL parameter or as a query parameter value.

43

This URL template can be used to geocode information from any country. For more accurate results, use User Context Parameters, such as the coordinates of a users current location. When you make a request by using one of the following URL templates, the response returns one or more Location resources that contain location information associated with the URL parameter values. The location information for each resource includes latitude and longitude coordinates, the type of location, and the geographical area that contains the location. For more information about the Location resource, see Location Data. You can also view the example URL and response values in the Examples section.

URL Template
These templates support both HTTP and HTTPS protocols.

You can increase the accuracy of a location result by specifying an IP address, user location or map area in the URL request. For more information about these parameters, see User Context Parameters. If you are using the Locations API from server-side code, you can set the userIP parameter to 127.0.0.1 (localhost) to prevent the servers location from affecting the location search results. Returns latitude and longitude coordinates for a location that is specified as query string. Structured URL A structured URL specifies the location data as part of the URL path.
http://dev.virtualearth.net/REST/v1/Locations/locationQuery?includeNeighborhood=includeNe ighborhood&maxResults=maxResults&include=queryParse&key=BingMapsKey

Unstructured URL An unstructured URL appends the location data to the URL path. In the following template, the location data is specified by using a query parameter that is appended to the end of the URL path.
http://dev.virtualearth.net/REST/v1/Locations?query=locationQuery&includeNeighborhood=inc ludeNeighborhood&include=queryParse&maxResults=maxResults&key=BingMapsKey

Template Parameters

See the Common Parameters and Types section for additional common parameters to use with these URLs. Common parameters include: Output Parameters: Includes response output types and the JSON callback parameters. Culture Parameter: Includes a list of the supported cultures.
44

User Context Parameters: Includes parameters that set user location and viewport values to assist with determining locations. For example, you can prioritize the set of locations returned by a location query when you provide information about the users location. When an alias is provided, you can use the alias to shorten the length of the query parameter. For example, query=1600 Pennsylvania Ave NW Washington, DC can be shortened to q=1600 Pennsylvania Ave NW Washington, DC. Parameters are not case-sensitive.

Parameters

Alias

Description

Values

query

Required. A string that contains information about a location, such Location as an address or landmark name. information Structured URL examples: . White%20House 1600%20Pennsylvania%20Ave%20NW%20Washingto n,%20DC Unstructured URL examples: query=White%20House q=1600%20Pennsylvania%20Ave%20NW%20Washing ton,%20DC

includeNeighborh inclnb ood

Optional. Specifies to include the neighborho od with the address information the response when it is available. Optional. Specifies to include the parsed query string values in the response.

One of the following values: 1: Include neighborhood information when available. 0 [default]: Do not include neighborhood information.

Example: inclnb=1

include

incl

The only option for this parameter is queryParse. When this parameter value is specified, the response shows how the query string was parsed into address values, such as addressLine, locality, adminDistrict, and postalCode. Example: incl=queryParse

45

Parameters

Alias

Description

Values

maxResults

maxR es

Optional. Specifies the maximum number of locations to return in the response.

A string that contains an integer between 1 and 20. The default value is 5. Example: maxResults=10

Response
One or more Location resources are returned in the response when you make a request by using these URL templates. For more information about the Location resource, see Location Data. For more information about the common response syntax for the Bing Maps REST Services, see Common Response Description. JSON and XML responses are provided for the URL examples in the following section. These URLs support JSON (application/json) and XML (application/xml) response formats. A JSON response is provided by default unless you request XML output by setting the output (o) parameter. For more information, see Output Parameters.

Examples
Find location information for an address using a query string. The following examples request latitude and longitude information for an address specified by the query string 1 Microsoft way, Redmond WA 98052. Both URLs return the same information. The results are requested in XML format.
http://dev.virtualearth.net/REST/v1/Locations/1%20Microsoft%20Way%20Redmond%20WA%2098052? o=xml&key=BingMapsKey

http://dev.virtualearth.net/REST/v1/Locations?q=1%20Microsoft%20Way%20Redmond%20WA%209805 2&o=xml&key=BingMapsKey

XML Response This example returns the following XML response.


<Response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/search/local/ws/rest/v1"> <Copyright> 46

Copyright 2011 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation. </Copyright> <BrandLogoUri> http://dev.virtualearth.net/Branding/logo_powered_by.png </BrandLogoUri> <StatusCode>200</StatusCode> <StatusDescription>OK</StatusDescription> <AuthenticationResultCode>ValidCredentials</AuthenticationResultCode> <TraceId> 717bea918cca4a7b9a5dabebb6d23c20 </TraceId> <ResourceSets> <ResourceSet> <EstimatedTotal>1</EstimatedTotal> <Resources> <Location> <Name>1 Microsoft Way, Redmond, WA 98052</Name> <Point> <Latitude>47.640120461583138</Latitude> <Longitude>-122.12971039116383</Longitude> </Point> <BoundingBox> <SouthLatitude>47.636257744012461</SouthLatitude> <WestLongitude>-122.13735364288299</WestLongitude> <NorthLatitude>47.643983179153814</NorthLatitude> <EastLongitude>-122.12206713944467</EastLongitude> </BoundingBox> <EntityType>Address</EntityType> <Address> <AddressLine>1 Microsoft Way</AddressLine> <AdminDistrict>WA</AdminDistrict> <AdminDistrict2>King Co.</AdminDistrict2> 47

<CountryRegion>United States</CountryRegion> <FormattedAddress>1 Microsoft Way, Redmond, WA 98052</FormattedAddress> <Locality>Redmond</Locality> <PostalCode>98052</PostalCode> </Address> <Confidence>High</Confidence> <MatchCode>Good</MatchCode> <GeocodePoint> <Latitude>47.640120461583138</Latitude> <Longitude>-122.12971039116383</Longitude> <CalculationMethod>InterpolationOffset</CalculationMethod> <UsageType>Display</UsageType> </GeocodePoint> <GeocodePoint> <Latitude>47.640144601464272</Latitude> <Longitude>-122.12976671755314</Longitude> <CalculationMethod>Interpolation</CalculationMethod> <UsageType>Route</UsageType> </GeocodePoint> </Location> </Resources> </ResourceSet> </ResourceSets> </Response>

JSON Response The following JSON response contains the same information as the XML response and is provided when the output (o) parameter is not set.
{ "authenticationResultCode":"ValidCredentials", "brandLogoUri":"http:\/\/dev.virtualearth.net\/Branding\/logo_powered_by.png", "copyright":"Copyright 2011 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.", 48

"resourceSets":[ { "estimatedTotal":1, "resources":[ {

"__type":"Location:http:\/\/schemas.microsoft.com\/search\/local\/ws\/rest\/v1", "bbox":[ 47.636257744012461, -122.13735364288299, 47.643983179153814, -122.12206713944467 ], "name":"1 Microsoft Way, Redmond, WA 98052", "point":{ "type":"Point", "coordinates":[ 47.640120461583138, -122.12971039116383 ] }, "address":{ "addressLine":"1 Microsoft Way", "adminDistrict":"WA", "adminDistrict2":"King Co.", "countryRegion":"United States", "formattedAddress":"1 Microsoft Way, Redmond, WA 98052", "locality":"Redmond", "postalCode":"98052" }, "confidence":"High", "entityType":"Address", "geocodePoints":[ { 49

"type":"Point", "coordinates":[ 47.640120461583138, -122.12971039116383 ], "calculationMethod":"InterpolationOffset", "usageTypes":[ "Display" ] }, { "type":"Point", "coordinates":[ 47.640144601464272, -122.12976671755314 ], "calculationMethod":"Interpolation", "usageTypes":[ "Route" ] } ], "matchCodes":[ "Good" ] } ] } ], "statusCode":200, "statusDescription":"OK", "traceId":"f461627364d64fd58c81b1d849ff3ec8 " }

Find location information and request query parse information.


50

The following URL performs the same query as the previous example, and also requests query parse information
http://dev.virtualearth.net/REST/v1/Locations/1%20Microsoft%20Way%20Redmond%20WA%2098052? include=queryParse&o=xml&key=BingMapsKey

This query returns the same response as above with the additional query parse information. XML Query Parse Response
<QueryParseValue Property="AddressLine" Value="1 Microsoft Way" /> <QueryParseValue Property="Locality" Value="Redmond" /> <QueryParseValue Property="PostalCode" Value="98052" /> <QueryParseValue Property="AdminDistrict" Value="WA" />

JSON Query Parse Response


"queryParseValues":[ { "property":"AddressLine", "value":"1 Microsoft Way" }, { "property":"Locality", "value":"Redmond" }, { "property":"PostalCode", "value":"98052" }, { "property":"AdminDistrict", "value":"WA" } ]

Find location information associated with a query string and relevant to the users location.
51

The following example searches for locations associated with the search query "Kings Road". Because the userLocation param eter is specified, the results returned are relevant to the users location. For more information about the userLocation parameter and other user context parameters, see User Context Parameters.
http://dev.virtualearth.net/REST/v1/Locations?culture=enGB&query=Kings%20Road&o=xml&userLocation=51.504360719046616,0.12600176611298197&o=xml&key=BingMapsKey

For an example of how to use the Locations query URL with the AJAX Core Map Control, see Displaying Location Search Results Using the REST Services and the AJAX 7 Control.

Find location information associated with a query string and request neighborhood information. The following example searches for locations associated with the search query "Greenwich, United Kingdom". Because the includeNeighborhood (inclnb) parameter is set to 1, the Neighborhood field is returned in the response.
http://dev.virtualearth.net/REST/v1/Locations/greenwich%20united%20kingdom?inclnb=1&o=xml &key=BingMapsKey

XML Response
<Response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/search/local/ws/rest/v1"> <Copyright> Copyright 2011 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation. </Copyright> <BrandLogoUri> http://dev.virtualearth.net/Branding/logo_powered_by.png </BrandLogoUri> <StatusCode>200</StatusCode> <StatusDescription>OK</StatusDescription> <AuthenticationResultCode>ValidCredentials</AuthenticationResultCode> <TraceId> 54cfe1520aa2409ab45dc489f5287c8b </TraceId>

52

<ResourceSets> <ResourceSet> <EstimatedTotal>1</EstimatedTotal> <Resources> <Location> <Name>Greenwich, London, United Kingdom</Name> <Point> <Latitude>51.484458923339844</Latitude> <Longitude>0.0024300001095980406</Longitude> </Point> <BoundingBox> <SouthLatitude>51.455488540347289</SouthLatitude> <WestLongitude>-0.0595597166159628</WestLongitude> <NorthLatitude>51.5134293063324</NorthLatitude> <EastLongitude>0.064419716835158874</EastLongitude> </BoundingBox> <EntityType>Neighborhood</EntityType> <Address> <AdminDistrict>England</AdminDistrict> <CountryRegion>United Kingdom</CountryRegion> <FormattedAddress>Greenwich, London, United Kingdom</FormattedAddress> <Locality>London</Locality> <Neighborhood>Greenwich</Neighborhood> </Address> <Confidence>High</Confidence> <MatchCode>Good</MatchCode> <GeocodePoint> <Latitude>51.484458923339844</Latitude> <Longitude>0.0024300001095980406</Longitude> <CalculationMethod>Rooftop</CalculationMethod> <UsageType>Display</UsageType> </GeocodePoint> </Location> </Resources> 53

</ResourceSet> </ResourceSets> </Response>

JSON Response The following JSON response contains the same information as the XML response and is provided when the output (o) parameter is not set.
{ "authenticationResultCode":"ValidCredentials", "brandLogoUri":"http:\/\/dev.virtualearth.net\/Branding\/logo_powered_by.png", "copyright":"Copyright 2011 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.", "resourceSets":[ { "estimatedTotal":1, "resources":[ {

"__type":"Location:http:\/\/schemas.microsoft.com\/search\/local\/ws\/rest\/v1", "bbox":[ 51.455488540347289, -0.0595597166159628, 51.5134293063324, 0.064419716835158874 ], "name":"Greenwich, London, United Kingdom", "point":{ "type":"Point", "coordinates":[ 51.484458923339844, 0.0024300001095980406 ] }, 54

"address":{ "adminDistrict":"England", "countryRegion":"United Kingdom", "formattedAddress":"Greenwich, London, United Kingdom", "locality":"London", "neighborhood":"Greenwich" }, "confidence":"High", "entityType":"Neighborhood", "geocodePoints":[ { "type":"Point", "coordinates":[ 51.484458923339844, 0.0024300001095980406 ], "calculationMethod":"Rooftop", "usageTypes":[ "Display" ] } ], "matchCodes":[ "Good" ] } ] } ], "statusCode":200, "statusDescription":"OK", "traceId":"5049ac0bcbcb46198f851c516883d464" }

Find location information for a landmark.


55

The following example requests location information for the Eiffel Tower.
http://dev.virtualearth.net/REST/v1/Locations/Eiffel%20Tower?o=xml&key=BingMapsKey

XML Response
<Response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/search/local/ws/rest/v1"> <Copyright> Copyright 2011 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation. </Copyright> <BrandLogoUri> http://dev.virtualearth.net/Branding/logo_powered_by.png </BrandLogoUri> <StatusCode>200</StatusCode> <StatusDescription>OK</StatusDescription> <AuthenticationResultCode>ValidCredentials</AuthenticationResultCode> <TraceId> 4095ee6d5c73457495db49dacf2abc56 </TraceId> <ResourceSets> <ResourceSet> <EstimatedTotal>1</EstimatedTotal> <Resources> <Location> <Name>Eiffel Tower, Paris, France</Name> <Point> <Latitude>48.857929229736328</Latitude> <Longitude>2.295259952545166</Longitude> </Point> <BoundingBox> <SouthLatitude>48.857460021972656</SouthLatitude> <WestLongitude>2.2933001518249512</WestLongitude> <NorthLatitude>48.859039306640625</NorthLatitude> <EastLongitude>2.2956900596618652</EastLongitude> 56

</BoundingBox> <EntityType>Monument</EntityType> <Address> <AdminDistrict>IdF</AdminDistrict> <AdminDistrict2>Paris</AdminDistrict2> <CountryRegion>France</CountryRegion> <FormattedAddress>Eiffel Tower, Paris, France</FormattedAddress> <Locality>Paris</Locality> <Landmark>Eiffel Tower</Landmark> </Address> <Confidence>High</Confidence> <MatchCode>Good</MatchCode> <GeocodePoint> <Latitude>48.857929229736328</Latitude> <Longitude>2.295259952545166</Longitude> <CalculationMethod>Rooftop</CalculationMethod> <UsageType>Display</UsageType> </GeocodePoint> </Location> </Resources> </ResourceSet> </ResourceSets> </Response>

JSON Response The following JSON response contains the same information as the XML response and is provided when the output (o) parameter is not set.
{ "authenticationResultCode":"ValidCredentials", "brandLogoUri":"http:\/\/dev.virtualearth.net\/Branding\/logo_powered_by.png", "copyright":"Copyright 2011 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.", "resourceSets":[ 57

{ "estimatedTotal":1, "resources":[ {

"__type":"Location:http:\/\/schemas.microsoft.com\/search\/local\/ws\/rest\/v1", "bbox":[ 48.857460021972656, 2.2933001518249512, 48.859039306640625, 2.2956900596618652 ], "name":"Eiffel Tower, Paris, France", "point":{ "type":"Point", "coordinates":[ 48.857929229736328, 2.295259952545166 ] }, "address":{ "adminDistrict":"IdF", "adminDistrict2":"Paris", "countryRegion":"France", "formattedAddress":"Eiffel Tower, Paris, France", "locality":"Paris", "landmark":"Eiffel Tower" }, "confidence":"High", "entityType":"Monument", "geocodePoints":[ { "type":"Point", "coordinates":[ 58

48.857929229736328, 2.295259952545166 ], "calculationMethod":"Rooftop", "usageTypes":[ "Display" ] } ], "matchCodes":[ "Good" ] } ] } ], "statusCode":200, "statusDescription":"OK", "traceId":"fb2339699bd24beab9766baf6382f926" }

Find location information and request up to 10 location results in the response. This example provides location information for the query string "New York" and requests up to 10 location results in the response. The default maximum number of locations returned is five (5) results.
http://dev.virtualearth.net/REST/v1/Locations?q=Greenville&maxResults=10&key=BingMapsKey

HTTP Status Codes


For more details about these HTTP status codes, see Status Codes and Error Handling. When the request is successful, the following HTTP status code is returned. 200 When the request is not successful, the response returns one of the following errors.
59

400 401 500 503

See Also
Displaying Location Search Results Using the REST Services and the AJAX 7 Control

Location Data
Location Resource
The response returned by a Locations URL contains one or more Location resources. Each Location resource contains location information that corresponds to the values provided in the request. This topic provides descriptions of the Locations resource fields, followed by JSON and XML examples. For more information about the common response container for the Bing Maps REST Services, see Common Response Description.
JSON XML Type Description

name point

Name Point

string Point. For more information about the Point type, see Location and Area Types. BoundingBox. For more information about the BoundingBox type, see Location and Area Types.

The name of the resource. The latitude and longitude coordinates of the location.

bbox

BoundingBox

A geographic area that contains the location. A bounding box contains SouthLatitude, WestLongitude, NorthLatitude, and EastLongitude values in units of degrees. The classification of the geographic entity returned, such as Address. For a list of entity types, see Entity
60

entityType

EntityType

string

JSON

XML

Type

Description

Types. address Address Address The postal address for the location. An address can contain AddressLine, Neighborhood, Locality, AdminDistrict, AdminDistrict2, CountryRegion, FormattedAddress, PostalCode, and Landmark fields. For more information about these fields, see Location and Area Types.

confidence

Confidence

One of the following The level of confidence values: that the geocoded High, Medium, Low location result is a match. Use this value with the match code to determine for more complete information about the match. The confidence of a geocoded location is based on many factors including the relative importance of the geocoded location and the users location, if specified. The following description provides more information about how confidence scores are assigned and how results are ranked. If the confidence is set to High, one or more strong matches were
61

JSON

XML

Type

Description

found. Multiple High confidence matches are sorted in ranked order by importance when applicable. For example, landmarks have importance but addresses do not. If a request includes a user location or a map area (see User Context Parameters), then the ranking may change appropriately. For example, a location query for "Paris" returns "Paris, France" and "Paris, TX" both with High confidence. "Paris, France" is always ranked first due to importance unless a user location indicates that the user is in or very close to Paris, TX or the map view indicates that the user is searching in that area. In some situations, the returned match may not be at the same level as the information provided in the request. For example, a request may specify address information and the geocode service may only be able to match a postal code. In this case, if the geocode service has a high
62

JSON

XML

Type

Description

confidence that the postal code matches the data, the confidence is set to High and the match code is set to UpHierarchy to specify that it could not match all of the information and had to search uphierarchy. If the location information in the query is ambiguous, and there is no additional information to rank the locations (such as user location or the relative importance of the location), the confidence is set to Medium. For example, a location query for "148th Ave, Bellevue" may return "148th Ave SE" and "148th Ave NE" both with Medium confidence. If the location information in the query does not provide enough information to geocode a specific location, a less precise location value may be returned and the confidence is set to Medium. For example, if an address is provided, but a match is not found for the house number, the geocode result with
63

JSON

XML

Type

Description

a Roadblock entity type may be returned. You can check the entityType field value to determine what type of entity the geocode result represents. For a list of entity types, see Entity Types. matchCodes MatchCode One or more of the following values: Good, Ambiguous, UpHierarchy One or more match code values that represent the geocoding level for each location in the response. For example, a geocoded location with match codes of Good and Ambiguous means that more than one geocode location was found for the location information and that the geocode service did not have search uphierarchy to find a match. Similarly, a geocoded location with match codes of Ambiguous and UpHierarchy means that a geocode location could not be found that matched all of the location information, so the geocode service had to search uphierarchy and found multiple matches at that level. An example of up an Ambiguous and UpHierarchy result is
64

JSON

XML

Type

Description

when you provide complete address information, but the geocode service cannot locate a match for the street address and instead returns information for more than one RoadBlock value. The possible values are: Good: The location has only one match or all returned matches are considered strong matches. For example, a query for New York returns several Good matches. Ambiguous: The location is one of a set of possible matches. For example, when you query for the street address 128 Main St., the response may return two locations for 128 North Main St. and 128 South Main St. because there is not enough information to determine which option to choose. UpHierarchy: The location represents a move up the geographic hierarchy. This occurs when a match for the location request was not found, so a less precise
65

JSON

XML

Type

Description

result is returned. For example, if a match for the requested address cannot be found, then a match code of UpHierarchy with a RoadBlock entity type may be returned. queryParseValues QueryParseValue collection A collection of parsed values that shows how a location query string was parsed into one or more of the following address values. geocodePoints GeocodePoint collection AddressLine Locality AdminDistrict AdminDistrict2 PostalCode CountryRegion Landmark

A collection of geocoded points that differ in how they were calculated and their suggested use. For a description of the points in this collection, see the Geocode Point Fields section below.

Geocode Point Fields The following fields are provided for each geocode point in the Geocode Points collection.
JSON XML Type Description

point

Point

Point. For more

The latitude and


66

JSON

XML

Type

Description

information about the Point type, see Location and Area Types. calculationMethod CalculationMethod One of the following values: Interpolation: The geocode point was matched to a point on a road using interpolation. InterpolationOffset: The geocode point was matched to a point on a road using interpolation with an additional offset to shift the point to the side of the street. ParcelCentroid: The geocode point was matched to the center of a parcel. Rooftop: The geocode point was matched to the rooftop of a building.

longitude coordinates of the geocode point. The method that was used to compute the geocode point.

usageTypes

usageType

One or more of the following values: Display Route

The best use for the geocode point. Each geocode point is defined as a Route point, a Display point or both. Use Route points if you are creating a route to the location. Use Display points if you are showing the location on a
67

JSON

XML

Type

Description

map. For example, if the location is a park, a Route point may specify an entrance to the park where you can enter with a car, and a Display point may be a point that specifies the center of the park.

Examples
JSON Example
{ "__type":"Location:http:\/\/schemas.microsoft.com\/search\/local\/ws\/rest\/v1", "bbox":[ 47.636705672917948, -122.137016420622, 47.6444311080593, -122.1217297861384 ], "name":"1 Microsoft Way, Redmond, WA 98052", "point":{ "type":"Point", "coordinates":[ 47.640568390488625, -122.1293731033802 ] }, "address":{ 68

"addressLine":"1 Microsoft Way", "adminDistrict":"WA", "adminDistrict2":"King Co.", "countryRegion":"United States", "formattedAddress":"1 Microsoft Way, Redmond, WA 98052", "locality":"Redmond", "postalCode":"98052" }, "confidence":"Medium", "entityType":"Address", "queryParseValues":[ { "property":"AddressLine", "value":"1 Microsoft Way" }, { "property":"Locality", "value":"Redmond" }, { "property":"PostalCode", "value":"98052" }, { "property":"AdminDistrict", "value":"WA" } ] "geocodePoints":[ { "type":"Point", "coordinates":[ 47.640568390488625, -122.1293731033802 69

], "calculationMethod":"Interpolation", "usageTypes":[ "Display", "Route" ] "matchCodes":[ "Good" ] } ] }

XML Example
<Location> <Name>1 Microsoft Way, Redmond, WA 98052</Name> <Point> <Latitude>47.640568390488625</Latitude> <Longitude>-122.1293731033802</Longitude> </Point> <BoundingBox> <SouthLatitude>47.636705672917948</SouthLatitude> <WestLongitude>-122.137016420622</WestLongitude> <NorthLatitude>47.6444311080593</NorthLatitude> <EastLongitude>-122.1217297861384</EastLongitude> </BoundingBox> <EntityType>Address</EntityType> <Address> <AddressLine>1 Microsoft Way</AddressLine> <AdminDistrict>WA</AdminDistrict> <AdminDistrict2>King Co.</AdminDistrict2> <CountryRegion>United States</CountryRegion> <FormattedAddress>1 Microsoft Way, Redmond, WA 98052</FormattedAddress> <Locality>Redmond</Locality>

70

<PostalCode>98052</PostalCode> </Address> <Confidence>Medium</Confidence> <MatchCode>Good</<MatchCode> <QueryParseValue Property="AddressLine" Value="1 Microsoft Way" /> <QueryParseValue Property="Locality" Value="Redmond" /> <QueryParseValue Property="PostalCode" Value="98052" /> <QueryParseValue Property="AdminDistrict" Value="WA" /> <GeocodePoint> <Latitude>47.640568390488625</Latitude> <Longitude>-122.1293731033802</Longitude> <CalculationMethod>Interpolation</CalculationMethod> <UsageType>Display</UsageType> <UsageType>Route</UsageType> </GeocodePoint> </Location>

Elevations API
Use the Elevations API to get elevation information for a set of locations, polyline or area on the Earth.

In this section
Get Elevations Use these URL templates to get elevations for a set of locations, a polyline or area on the Earth. Use this description to understand the data values returned in the response. Use this algorithm to create a compressed encoded string that represents a large number of locations. You can then use this string in place of a long list of coordinates when you request elevations.

Elevation Data Point Compression Algorithm

71

Get Elevations
Use the following URLs to get elevation values (in meters) for a set of locations, a polyline path or area on the Earth.

URL Templates
These templates support both HTTP and HTTPS protocols and can be POST or GET requests. To use this API, you must have a Bing Maps Key. Unit of elevation: meters Get elevations for latitude and longitude coordinates. Elevations are returned for each set of coordinates. Required parameters: points, key
http://dev.virtualearth.net/REST/v1/Elevation/List?points=lat1,long1,lat2,long2,latn,long n&heights=heights&key=BingMapsKey

Get elevations at equally-spaced locations along a polyline path. A polyline path is computed from the coordinates, and then elevation values at both endpoints and equally-spaced locations along the polyline are returned. The samples parameter specifies the number of elevations to return. Required parameters: points, samples, key
http://dev.virtualearth.net/REST/v1/Elevation/Polyline?points=lat1,long1,lat2,long2,latn, longn&heights=heights&samples=samples&key=BingMapsKey

Get elevations at equally-spaced locations within an area on the Earth defined as a bounding box. The rectangular area defined by the four (4) bounding box coordinates (south latitude, west longitude, north latitude, east longitude) is divided into rows and columns. The edges of the bounding box account for two (2) of the rows and two (2) of the columns. Elevations are returned for the vertices of the grid created by the rows and columns. For example, if you had specified rows=4 and columns=4, then 16 elevations are returned. The elevation values are ordered starting with the southwest corner, and then proceed west to east and south to north. This is illustrated in the following diagram. The elevation points are numbered in the order that they are returned.

72

Required parameters: bounds, rows, cols, key


http://dev.virtualearth.net/REST/v1/Elevation/Bounds?bounds=boundingBox&rows=rows&cols=co ls&heights=heights&key=BingMapsKey

Get the offset of the geoid sea level Earth model from the ellipsoid Earth model at a set of latitude and longitude coordinates. This request returns the offset in meters of the geoid model (heights=sealevel) from the ellipsoid model (heights=ellipsoid) at each location (difference = geoid_sealevel - ellipsoid_sealevel). Required parameters: points, key
http://dev.virtualearth.net/REST/v1/Elevation/SeaLevel?points=lat1,long1,lat2,long2,latn, longn&key=BingMapsKey

About Elevations and Coordinate Values: Elevation values can be calculated using to two different Earth models the ellipsoid model and the geoid sea level model. The ellipsoid model uses the World Geodetic System (WGS84) which is an ellipsoidal approximation of the Earth. The geoid sea level model uses the Earth Gravitational Model 2008 (EGM2008 2.5) and computes a sea level based on the local value of gravity. The ellipsoid model is equivalent to GPS and the geoid sea level model is equivalent what is commonly known as the height above sea level. For a more detailed description of the two models, see the Earth Models and Zoom Level section below. Set the heights parameter to ellipsoid or sealevel to specify the model to use. If the heights parameter is not specified, the sea level model is used Latitudes and longitudes in the URL are expected to be in WGS84 decimal degrees. (Example: 34.2412,-119.3829) The maximum number of elevations returned in a request is 1024.

If you are submitting a large number of locations, you can use the HTTP POST protocol or the Point Compression Algorithm.

Template Parameters
Parameters and parameter values are not case-sensitive. Additional parameters, such output and JSON callback parameters, are found in Output Parameters.

Parameters in the following table are valid for a URL only when they appear in the templates above.
Parameters Alias Description Values

points=lat1,long1,lat2,long2,latn,longn

pts

Required. A set of coordinates on the Earth to use in elevation calculations.

A set of latitude and longitude values in WGS84 decimal degrees. If you are requesting elevations or
73

Parameters

Alias

Description

Values

The exact use of these points depends on the type of elevation request.

elevation offsets for a set of points, the maximum number of points is 1024. If you have a large number of values, you can use the HTTP POST protocol or the Point Compression Algorithm. Example: points=35.89431,110.72522,35.89393,110.72578,35.89374

bounds

Required. Specifies the rectangular area over which to provide elevation values.

A bounding box defined as a set of WGS84 latitudes and longitudes in the following order: south latitude, west longitude, north latitude, east longitude Example: bounds=45.219,122.234,47.61,-122.07

rows, cols

Required. Specifies the number of rows and columns to use to divide the bounding box area into a grid. The rows and columns that define the bounding box each count as two (2) of the rows and columns. Elevation values

Integers with a value of two (2) or greater. The number of rows and columns can define a maximum of 1024 locations (rows * cols <= 1024). Examples: rows=30 cols=15

74

Parameters

Alias

Description

Values

are returned for all vertices of the grid. samples samp Required. Specifies the number of equally-spaced elevation values to provide along a polyline path. Optional. Specifies which sea level model to use to calculate elevation. A positive integer. The maximum number of samples is 1024. Example: samples=30

heights

hts

One of the following values. sealevel [default]: Use the geoid Earth model (EGM2008 2.5). ellipsoid: Use the ellipsoid Earth model (WGS84). For more information about these models, see the Earth Models and Zoom Level section below. Example: heights=ellipsoid

key

Required. A Bing Maps Key.

If you do not have a Bing Maps Key, see Getting a Bing Maps Key.

Earth Models and Zoom Level


Elevation calculations can vary based on the model of the Earth used and the zoom level. Earth model: The Elevations API uses two Earth models an ellipsoid model that is equivalent to a GPS calculation, and geoid sea level model that is what is commonly referred to as altitude above sea level. The ellipsoid model approximates the Earth as an ellipsoid and uses the World Geodetic System (WGS84). With the ellipsoid model, the elevation is calculated as a height above the ellipsoid.

75

The geoid sea level model is an approximation of Mean Sea Level that uses an equipotential surface of the Earths gravitational field. The geoid model uses the Earth Gravitational Model 2008 (EGM2008 2.5). Because gravity varies by location, the geoid sea level model is not a smooth shape like the ellipsoid model. You can specify the Earth model by setting the heights parameter to ellipsoid or sealevel (geoid). The following diagram shows how the ellipsoid and geoid sea level models can vary and how elevation is measured for both models.

Zoom level : A zoom level is returned in the response, and reflects the resolution of the data used to compute the elevation. A higher zoom level indicates higher resolution data and more accurate elevation values. At lower zoom levels, the data is further apart and interpolated points are less accurate. For information about the data resolution at different zoom levels, see Understanding Scale and Resolution. Typically, lower zoom levels are used for areas that have limited data or when you request elevations for points or a polyline that covers a large distance. For example if you request a polyline that covers a large distance across the Earth, such as the distance between Paris and Beijing, the points used to compute elevation are associated with a higher zoom level and are further apart.

Elevation Coverage and Resolution


The following table shows the minimum elevation resolution by area. Actual elevation resolution may be may be higher.
Coverage Area Resolution (in meters)

Global (including poles) Global 56 S - 60 N United States

900 m 90 m 10 m
76

Response
A set of elevations and the associated zoom level is returned in the responses that request elevation values. For descriptions of the data returned in the response, see Elevation Data. For more information about the common values that are also returned in the response, see Common Response Description. You can choose JSON (application/json) or XML (application/xml) format for the response. JSON is returned by default. To specify the format, set the output (o) parameter to json or xml. For more information, see Output Parameters.

Examples

Get elevations for a set of latitude and longitude coordinates. The geoid Earth model is used to compute elevations for the coordinates provided.
http://dev.virtualearth.net/REST/v1/Elevation/List?points=35.89431,-110.72522,35.89393,110.72578,35.89374,-110.72606,35.89337,-110.72662&key=BingMapsKey

JSON Response This example returns the following response where values are the elevation values and zoomLevel is the zoom level used.
{ "authenticationResultCode":"ValidCredentials", "brandLogoUri":"http:\/\/dev.virtualearth.net\/Branding\/logo_powered_by.png", "copyright":"Copyright 2012 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.", "resourceSets":[ { "estimatedTotal":1, "resources":[ {

"__type":"ElevationData:http:\/\/schemas.microsoft.com\/search\/local\/ws\/rest\/v1", "elevations":[1776,1775,1777,1776], "zoomLevel":14 77

} ] } ], "statusCode":200, "statusDescription":"OK", "traceId":"8d57dbeb0bb94e7ca67fd25b4114f5c3" }

XML Response This XML response is returned when output=xml is added to the URL.
<Response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/search/local/ws/rest/v1"> <Copyright> Copyright 2012 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation. </Copyright> <BrandLogoUri>http://dev.virtualearth.net/Branding/logo_powered_by.png</BrandLogoUri> <StatusCode>200</StatusCode> <StatusDescription>OK</StatusDescription> <AuthenticationResultCode>ValidCredentials</AuthenticationResultCode> <TraceId> 3e6771dbe66045a18f72a787dc8c8deb </TraceId> <ResourceSets> <ResourceSet> <EstimatedTotal>1</EstimatedTotal> <Resources> <ElevationData> <ZoomLevel>14</ZoomLevel> <Elevations> <int>1776</int> <int>1775</int> <int>1777</int> 78

<int>1776</int> </Elevations> </ElevationData> </Resources> </ResourceSet> </ResourceSets> </Response>

Get the elevations for a rectangular area on the Earth. The geoid model is used to compute the elevations at the vertices of a rectangular grid. The bounds (bounding box) values specify an area that is further divided by the number of rows and columns specified. Two (2) rows and two (2) columns represent the bounding box.
http://dev.virtualearth.net/REST/v1/Elevation/Bounds?bounds=50.995391,1.320763,51.000577,-1.311836&rows=4&cols=4&key=BingMapsKey

JSON Response This example returns the following response where values are the elevation values and zoomLevel is the zoom level used.
{ "authenticationResultCode":"ValidCredentials", "brandLogoUri":"http:\/\/dev.virtualearth.net\/Branding\/logo_powered_by.png", "copyright":"Copyright 2012 Microsoft and its suppliers. All rights reserved. This A PI cannot be accessed and the content and any results may not be used, reproduced or tran smitted in any manner without express written permission from Microsoft Corporation.", "resourceSets":[ { "estimatedTotal":1, "resources":[ { "__type":"ElevationData:http:\/\/schemas.microsoft.com\/search\/local\/ws\ /rest\/v1", "elevations":[35,39,42,41,35,37,39,43,38,37,41,40,37,41,48,49], "zoomLevel":11 79

} ] } ], "statusCode":200, "statusDescription":"OK", "traceId":"55ae05364e3d4ca3a6b6ed864b9e652a" }

XML Response This XML response is returned when output=xml is added to the URL.
<Response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/search/local/ws/rest/v1"> <Copyright> Copyright 2012 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation. </Copyright> <BrandLogoUri> http://dev.virtualearth.net/Branding/logo_powered_by.png </BrandLogoUri> <StatusCode>200</StatusCode> <StatusDescription>OK</StatusDescription> <AuthenticationResultCode>ValidCredentials</AuthenticationResultCode> <TraceId> e039402824834526bd60c8db99c3e837 </TraceId> <ResourceSets> <ResourceSet> <EstimatedTotal>1</EstimatedTotal> <Resources> <ElevationData> <ZoomLevel>11</ZoomLevel> <Elevations> <int>35</int> 80

<int>39</int> <int>42</int> <int>41</int> <int>35</int> <int>37</int> <int>39</int> <int>43</int> <int>38</int> <int>37</int> <int>41</int> <int>40</int> <int>37</int> <int>41</int> <int>48</int> <int>49</int> </Elevations> </ElevationData> </Resources> </ResourceSet> </ResourceSets> </Response>

Get the elevations at equally-spaced locations along a polyline. A polyline path is computed from the latitude and longitude values. Elevations are computed for the endpoints and eight (8) equally-spaced points in between. The ellipsoid Earth model is used to compute the elevations because heights=ellipsoid is specified.
http://dev.virtualearth.net/REST/v1/Elevation/Polyline?points=35.89431,110.72522,35.89393,-110.72578,35.89374,-110.72606,35.89337,110.72662&heights=ellipsoid&samples=10&key=BingMapsKey

JSON Response This example returns the following response where values are the elevation values and zoomLevel is the zoom level used.
81

{ "authenticationResultCode":"ValidCredentials", "brandLogoUri":"http:\/\/dev.virtualearth.net\/Branding\/logo_powered_by.png", "copyright":"Copyright 2012 Microsoft and its suppliers. All rights reserved. This A PI cannot be accessed and the content and any results may not be used, reproduced or tran smitted in any manner without express written permission from Microsoft Corporation.", "resourceSets":[ { "estimatedTotal":1, "resources":[ { "__type":"ElevationData:http:\/\/schemas.microsoft.com\/search\/local\/ws\ /rest\/v1", "elevations":[1753,1752,1752,1752,1752,1754,1754,1754,1754,1753], "zoomLevel":14 } ] } ], "statusCode":200, "statusDescription":"OK", "traceId":"3080e93328564e91abb68493ae826e2d" }

XML Response This XML response is returned when output=xml is added to the URL.
<Response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/search/local/ws/rest/v1"> <Copyright> Copyright 2012 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation. </Copyright> <BrandLogoUri> http://veintplat2.live-int.com/Branding/logo_powered_by.png 82

</BrandLogoUri> <StatusCode>200</StatusCode> <StatusDescription>OK</StatusDescription> <AuthenticationResultCode>ValidCredentials</AuthenticationResultCode> <TraceId> 38ef4ca6e6da45508a3ea5225e730fca </TraceId> <ResourceSets> <ResourceSet> <EstimatedTotal>1</EstimatedTotal> <Resources> <ElevationData> <ZoomLevel>14</ZoomLevel> <Elevations> <int>1753</int> <int>1752</int> <int>1752</int> <int>1752</int> <int>1752</int> <int>1754</int> <int>1754</int> <int>1754</int> <int>1754</int> <int>1753</int> </Elevations> </ElevationData> </Resources> </ResourceSet> </ResourceSets> </Response>

83

Get the offset of the geoid sea level model from the ellipsoid model at the specified locations.
http://dev.virtualearth.net/REST/v1/Elevation/SeaLevel?points=35.89431,110.72522,35.89393,-110.72578,35.89374,-110.72606,35.89337,-110.72662&key=BingMapsKey

JSON Response This example returns the following response where values show that the geoid sea level approximation is 23 meters below the ellipsoid at each location.
{ "authenticationResultCode":"ValidCredentials", "brandLogoUri":"http:\/\/dev.virtualearth.net\/Branding\/logo_powered_by.png", "copyright":"Copyright 2012 Microsoft and its suppliers. All rights reserved. This A PI cannot be accessed and the content and any results may not be used, reproduced or tran smitted in any manner without express written permission from Microsoft Corporation.", "resourceSets":[ { "estimatedTotal":1, "resources":[ { "__type":"SeaLevelData:http:\/\/schemas.microsoft.com\/search\/local\/ws\/ rest\/v1", "offsets":[-23, -23, -23, -23], "zoomLevel":14 } ] } ], "statusCode":200, "statusDescription":"OK", "traceId":"ec8ceb0a09754aa3b9e981cb13a4282a" }

XML Response This XML response is returned when output=xml is added to the URL.

84

<Response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/search/local/ws/rest/v1"> <Copyright> Copyright 2012 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation. </Copyright> <BrandLogoUri>http://dev.virtualearth.net/Branding/logo_powered_by.png</BrandLogoUri> <StatusCode>200</StatusCode> <StatusDescription>OK</StatusDescription> <AuthenticationResultCode>ValidCredentials</AuthenticationResultCode> <TraceId> e55037868ba34371a859462f7a0c59f3 </TraceId> <ResourceSets> <ResourceSet> <EstimatedTotal>1</EstimatedTotal> <Resources> <SeaLevelData> <ZoomLevel>14</ZoomLevel> <Offsets> <int>-23</int> <int>-23</int> <int>-23</int> <int>-23</int> </Offsets> </SeaLevelData> </Resources> </ResourceSet> </ResourceSets> </Response>

85

Use HTTP POST to get elevations You can use HTTP POST protocol to make any request that takes the points parameter. You may want to do this if you have a large number of locations in your request. If you are typically requesting elevations for 400 points or less, you may want to implement the Point Compression Algorithm. HTTP POST URL
http://dev.virtualearth.net/REST/v1/Elevation/List?key=BingMapsKey

HTTP POST Header


Content-Length: insertLengthOfHTTPBody Content-Type: text/plain; charset=utf-8

HTTP POST Body


points=38.8895,77.0501,38.8877,-77.0472,38.8904,-77.0474,38.8896,77.0351

Elevation Data
The response returned by an Elevations URL can contain elevation or sea level offset resource data. These resources are provided within a common response container. For a description, see Common Response Description.

Elevation and Sea Level Offset Resource Data


JSON XML Type Description

elevations offsets

Elevations Offsets

array of integers array of integers

A list of elevation values in meters. The difference between sea level models for a set of locations. The zoom level used to compute the elevation values. Zoom level values are from 1 to 21. A lower value typically means less accurate
86

zoomLevel

ZoomLevel

integer

JSON

XML

Type

Description

results because the resolution of the elevation data is less. At lower resolutions, interpolated elevation values use data points that are further apart. The zoom level used depends on the amount of elevation data available in a region and can be lowered when the specified path covers a long distance.

Examples
Elevations Resource JSON Response
{ "authenticationResultCode":"ValidCredentials", "brandLogoUri":"http:\/\/dev.virtualearth.net\/Branding\/logo_powered_by.png", "copyright":"Copyright 2012 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.", "resourceSets":[ { "estimatedTotal":1, "resources":[ {

"__type":"ElevationData:http:\/\/schemas.microsoft.com\/search\/local\/ws\/rest\/v1", "elevations":[1776,1775,1777,1776], "zoomLevel":14 } ] 87

} ], "statusCode":200, "statusDescription":"OK", "traceId":"8d57dbeb0bb94e7ca67fd25b4114f5c3" }

XML Response
<Response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/search/local/ws/rest/v1"> <Copyright> Copyright 2012 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation. </Copyright> <BrandLogoUri>http://dev.virtualearth.net/Branding/logo_powered_by.png</BrandLogoUri> <StatusCode>200</StatusCode> <StatusDescription>OK</StatusDescription> <AuthenticationResultCode>ValidCredentials</AuthenticationResultCode> <TraceId> 3e6771dbe66045a18f72a787dc8c8deb </TraceId> <ResourceSets> <ResourceSet> <EstimatedTotal>1</EstimatedTotal> <Resources> <ElevationData> <ZoomLevel>14</ZoomLevel> <Elevations> <int>1776</int> <int>1775</int> <int>1777</int> <int>1776</int> </Elevations>

88

</ElevationData> </Resources> </ResourceSet> </ResourceSets> </Response>

Sea Level Offset Resource JSON Response


{ "authenticationResultCode":"ValidCredentials", "brandLogoUri":"http:\/\/dev.virtualearth.net\/Branding\/logo_powered_by.png", "copyright":"Copyright 2012 Microsoft and its suppliers. All rights reserved. This A PI cannot be accessed and the content and any results may not be used, reproduced or tran smitted in any manner without express written permission from Microsoft Corporation.", "resourceSets":[ { "estimatedTotal":1, "resources":[ { "__type":"SeaLevelData:http:\/\/schemas.microsoft.com\/search\/local\/ws\/ rest\/v1", "offsets":[-23, -23, -23, -23], "zoomLevel":14 } ] } ], "statusCode":200, "statusDescription":"OK", "traceId":"ec8ceb0a09754aa3b9e981cb13a4282a" }

XML Response

89

<Response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/search/local/ws/rest/v1"> <Copyright> Copyright 2012 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation. </Copyright> <BrandLogoUri>http://dev.virtualearth.net/Branding/logo_powered_by.png</BrandLogoUri> <StatusCode>200</StatusCode> <StatusDescription>OK</StatusDescription> <AuthenticationResultCode>ValidCredentials</AuthenticationResultCode> <TraceId> e55037868ba34371a859462f7a0c59f3 </TraceId> <ResourceSets> <ResourceSet> <EstimatedTotal>1</EstimatedTotal> <Resources> <SeaLevelData> <ZoomLevel>14</ZoomLevel> <Offsets> <int>-23</int> <int>-23</int> <int>-23</int> <int>-23</int> </Offsets> </SeaLevelData> </Resources> </ResourceSet> </ResourceSets> </Response>

90

Point Compression Algorithm


When the number of points (latitude and longitude pairs) becomes too large, the length of the URL request may exceed limits imposed by clients, proxies, or the server. To reduce the size of the request or when you cannot use the HTTP POST method, you can implement the compression algorithm described below to get a compressed string that you can use instead of the lengthy points list. The points parameter in the Elevation API URLs supports these compressed strings and automatically returns uncompressed elevation data. There is no need for a decompression algorithm. This algorithm is best for 400 points or less. If you are requesting elevation data for more than 400 points, make an HTTP POST request. The following example shows the difference in size between a list of points and the equivalent compressed string. Original Values points=35.894309002906084,-110.72522000409663,35.893930979073048,110.72577999904752,35.893744984641671,-110.72606003843248,35.893366960808635,110.72661500424147 Equivalent Compressed Value points=vx1vilihnM6hR7mEl2Q The following example shows how to use this encoded value as the points value when you request elevation values along a polyline path.
http://dev.virtualearth.net/REST/v1/Elevation/Polyline?points=vx1vilihnM6hR7mEl2Q&samples =20&heights=sealevel&key=BingMapsKey

Algorithm Description
The following step-by-step instructions describe the point compression algorithm complete with an example. A test URL that you can use with a small number of points to test your algorithm implementation is described in Testing Your Algorithm Implementation, and a JavaScript Implementation is provided. 1. Start with a set of latitude and longitude values. 35.894309002906084, -110.72522000409663 35.893930979073048, -110.72577999904752 35.893744984641671, -110.72606003843248 35.893366960808635, -110.72661500424147 2. Multiply each value by 100000 and round each result to the nearest integer. 3589431, -11072522 3589393, -11072578 3589374, -11072606
91

3589337, -11072662 3. Calculate the difference between every pair of values. If a longitude difference exceeds +18000000 or -18000000, add or subtract 36000000 from the value. If your set of points spans a path that is greater than 180 degrees, divide the path into multiple segments so that no individual segment exceeds 180 degrees.

3589431, -11072522 -38, -19, -37, -56 -28 -56

4. Multiply each value by 2. 7178862, -22145044 -76, -38, -74, -112 -56 -112

5. If any value is negative, change it to be a positive value, and then subtract 1. 7178862, 75, 37, 73, 22145043 111 55 111

6. For each pair of latitude and longitude coordinates, compute the following value: ((latitude + longitude) * (latitude + longitude + 1) / 2) + latitude. This can require up to 51 bits of precision. (Javascript performs exact arithmetic with up to 53 bits of precision). 429945724065327 17466 4315 17093 7. For each number, form a list of numbers by dividing the number by 32 repeatedly and recording each remainder. Stop when the quotient (not the remainder) reaches zero. If you start at zero, just record a zero.

92

For example, 17466 divided by 32 is 545 with a remainder of 26, so "26" is the first number. Divide 545 by 32 to get 17 with a remainder of 1 making "1" the second number. Divide 17 by 32 to get zero with a remainder of 17 making "17". the last and final number in the sequence. 15, 17, 21, 15, 2, 5, 2, 1, 7, 12 26, 1, 17 27, 6, 4 5, 22, 16 8. Add 32 to each number except for the last number in each list. 47, 49, 53, 47, 34, 37, 34, 33, 39, 12 58, 33, 17 59, 38, 4 37, 54, 16 9. Form a string by converting each number to a character using the following lookup table. 0 A 1 B 2 C 3 D 4 E 5 F 6 G 7 H 8 I 9 J 10 K 11 L 12 M 13 N 14 O 15 P

16 Q

17 R

18 S

19 T

20 U

21 V

22 W

23 X

24 Y

25 Z

26 a

27 b

28 c

29 d

30 e

31 f

32 g

33 h

34 i

35 j

36 k

37 l

38 m

39 n

40 o

41 p

42 q

43 r

44 s

45 t

46 u

47 v

48 w

49 x

50 y

51 z

52 0

53 1

54 2

55 3

56 4

57 5

58 6

59 7

60 8

61 9

62 _

63 -

vx1vilihnM 6hR 7mE l2Q 10. Concatenate the strings and use this string as the encoded value for the points parameter.
93

points=vx1vilihnM6hR7mEl2Q

JavaScript Implementation
The following JavaScript code is an implementation of this algorithm.
function encodePoints(points) { var latitude = 0; var longitude = 0; var result = []; var l;

for (var point in points ) {

// step 2 var newLatitude = Math.round(points[point][0] * 100000); var newLongitude = Math.round(points[point][1] * 100000);

// step 3 var dy = newLatitude - latitude; var dx = newLongitude - longitude; latitude = newLatitude; longitude = newLongitude;

// step 4 and 5 dy = (dy << 1) ^ (dy >> 31); dx = (dx << 1) ^ (dx >> 31);

// step 6 var index = ((dy + dx) * (dy + dx + 1) / 2) + dy;

while (index > 0) {

// step 7 var rem = index & 31; 94

index = (index - rem) / 32;

// step 8 if (index > 0) rem += 32;

// step 9 result.push("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_"[rem]); } }

// step 10 return result.join(""); }

Testing Your Algorithm Implementation


The following URL is provided for you to test your algorithm. You can compare the compressed string computed by this URL for a small number of points to the compressed string computed by your implementation. There is no value in using this to create the compressed string in general because you are subject to the same length limitation as the Elevation API URLs.
http://dev.virtualearth.net/REST/v1/Elevation/PointCompression?points=lat1,long1,lat2,lon g2,latn,longn&key=BingMapsKey

Example TEST Request: The following request provides a set of test points in the URL request, and the response returns a compressed string in the value (JSON) or Value (XML) field.
http://dev.virtualearth.net/REST/v1/Elevation/PointCompression?points=35.894309002906084, -110.72522000409663,35.893930979073048,-110.72577999904752,35.893744984641671,110.72606003843248&key=BingMapsKey

JSON TEST Response


{ "authenticationResultCode":"ValidCredentials", "brandLogoUri":"http:\/\/dev.virtualearth.net\/Branding\/logo_powered_by.png", "copyright":"Copyright 2012 Microsoft and its suppliers. All rights reserved. This A PI cannot be accessed and the content and any results may not be used, reproduced or tran smitted in any manner without express written permission from Microsoft Corporation.", "resourceSets":[ { 95

"estimatedTotal":1, "resources":[ { "__type":"CompressedPointList:http:\/\/schemas.microsoft.com\/search\/loca l\/ws\/rest\/v1", "value":"vx1vilihnM6hR7mEl2Q" } ] } ], "statusCode":200, "statusDescription":"OK", "traceId":"31fbc5fa9724425487a63838d552ae0b" }

XML Test Response


<Response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/search/local/ws/rest/v1"> <Copyright> Copyright 2012 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation. </Copyright> <BrandLogoUri>http://dev.virtualearth.net/Branding/logo_powered_by.png</BrandLogoUri> <StatusCode>200</StatusCode> <StatusDescription>OK</StatusDescription> <AuthenticationResultCode>ValidCredentials</AuthenticationResultCode> <TraceId> 84aafc1217a94048a396338e4cdaefdf </TraceId> <ResourceSets> <ResourceSet> <EstimatedTotal>1</EstimatedTotal> <Resources> <CompressedPointList> 96

<Value>vx1vilihnM6hR7mEl2Q</Value> </CompressedPointList> </Resources> </ResourceSet> </ResourceSets> </Response>

Imagery API
Use the Imagery API to get static maps and Bing Maps imagery information.

In this section
Get a Static Map Get Imagery Metadata Use these URL templates to get a static map. You can also display a route on a static map. Use these URL templates to get metadata for imagery that is hosted by Bing Maps, such as imagery tiles. Use this description to understand the results returned in a response that contains imagery metadata. Use this description to understand the results returned in a response that contains static map metadata.

Imagery Metadata

Static Map Data

See Also
Show Bing Results on a Map Displaying Location Search Results Using the REST Services

Get a Static Map


Use the following URL templates to get a static map. You can also display a route on a static map, and you can request static map metadata. Static map metadata includes the absolute (latitude and longitude) and relative (with respect to the map) coordinates and size of pushpins as well as the map area and center point.

97

On July 6, 2011, the new enhanced road style that is already in use on http://www.bing.com/maps/ became the default and only road map style for Road, Birdseye with Labels and Aerial with Labels imagery sets.

URL Templates
The default map size is 350 pixels by 350 pixels.

These templates support both HTTP and HTTPS protocols. Static map metadata: To get the size and center point of the image and the locations and size of the pushpins on the map, set the mapMetadata parameter to 1 (true). When you request static map metadata, the metadata is returned instead of the map image. Get a map that is centered at a specified point. When you specify a center point, you must also specify a zoom level.
http://dev.virtualearth.net/REST/v1/Imagery/Map/imagerySet/centerPoint/zoomLevel?mapSize= mapSize&pushpin=pushpin&mapLayer=mapLayer&format=format&mapMetadata=mapMetadata&key=BingM apsKey

Get a map that shows a specified map area.


http://dev.virtualearth.net/REST/v1/Imagery/Map/imagerySet?mapArea=mapArea&mapSize=mapSiz e&pushpin=pushpin&mapLayer=mapLayer&format=format&mapMetadata=mapMetadata&key=BingMapsKey

Get a map with pushpins that does not specify a center point or map area. If you do not specify a center point or map area, the map area is chosen to optimize the display of the pusphins.
http://dev.virtualearth.net/REST/v1/Imagery/Map/imagerySet?pushpin=pushpin_1&pushpin=push pin_2&pushpin=pushpin_n&mapLayer=mapLayer&format=format&mapMetadata=mapMetadata&key=BingM apsKey

Get a map that is centered at the specified point and that displays a route. You can display a route on a map by specifying a set of waypoints.
http://dev.virtualearth.net/REST/v1/Imagery/Map/imagerySet/centerPoint/zoomLevel/Routes/t ravelMode?waypoint.1=routeWaypoint1&waypoint.2=routeWaypoint2&waypoint.n=routeWaypointn&m apSize=mapSize&avoid=avoidOptions&pushpin=pushpin&timeType=timetType&dateTime=dateTime&ma xSolutions=maxSolutions&distanceBeforeFirstTurn=distanceBeforeFirstTurn&mapLayer=mapLayer &format=format&mapMetadata=mapMetadata&key=BingMapsKey

Get a map that displays a route without specifying a center point. You can choose to specify the map area or you can accept the default. You can display a route on a map by specifying a set of waypoints. When a map area or a center point and a zoom level are not specified, a map area is chosen to optimize the display of the route.
98

http://dev.virtualearth.net/REST/v1/Imagery/Map/imagerySet/Routes/travelMode?waypoint.1=r outeWaypoint1&waypoint.2=routeWaypoint2&waypoint.n=routeWaypointn&mapArea=mapArea&avoid=a voidOptions&pushpin=pushpin&timeType=timeType&dateTime=dateTime&maxSolutions=maxSolutions &distanceBeforeFirstTurn=distanceBeforeFirstTurn&mapLayer=mapLayer&format=format&mapMetad ata=mapMetadata&key=BingMapsKey

Get a map that is based on a query.


http://dev.virtualearth.net/REST/v1/Imagery/Map/imagerySet/query?mapSize=mapSize&mapLayer =mapLayer&format=format&mapMetadata=mapMetadata&key=BingMapsKey

Pushpin limits: If you use HTTP GET method with the following URL templates, you can specify up to 18 pushpins in the URL. If you want to specify more than 18 pushpins, use the HTTP POST method and specify up to 100 pushpins in the body of the HTTP POST request. If you use the HTTP POST method, all pushpins must be in the body of the request and not in the URL, and you must set the Content-Type to text/plain and the charset to UTF-8 in the HTTP header. For a sample request, see the Examples section. Template Parameters

See the Common Parameters and Types section for additional common parameters to use with these URLs. Common parameters include: Output Parameters: Includes response output types and the JSON callback parameters. Culture Parameter: Includes a list of the supported cultures. User Context Parameters: Includes parameters that set user location and viewport values to help determine locations. For example, these values may help prioritize a set of possible locations when you get a map based on a location query. Parameter values are not case-sensitive. When an alias is provided, you can use the alias to shorten the length of the query parameter. For example, pushpin=47.610,-122.107 can be shortened to pp=47.610,122.107. Map Parameters
Parameter Alias Description Values

centerPoint

Required. A point on the Earth where the map is centered.

A Point value (latitude and longitude). For more information about Point values, see Location and Area Types.
99

Parameter

Alias

Description

Values

Example: centerPoint=47.610,-122.107 declutterPins dcl Optional. Specifies whether to change the display of overlapping pushpins so that they display separately on a map. One of the following values: 1: Declutter pusphpin icons. 0 [default]: Do not declutter pushpin icons.

Examples: declutter=1 dcl =1

format

fmt

Optional. The image format to use for the static map.

One of the following image format values: gif: Use GIF image format. jpeg: Use JPEG image format. JPEG format is the default for Road, Aerial and AerialWithLabels imagery. png: Use PNG image format. PNG is the default format for CollinsBart and OrdnanceSurvey imagery.

Examples: format=jpeg fmt=gif imagerySet Required. The type of imagery. One of the following values: Aerial Aerial imagery. AerialWithLabels Aerial imagery with a road overlay. Road Roads without additional imagery. OrdnanceSurvey -Ordnance Survey imagery.
100

Parameter

Alias

Description

Values

mapArea ma Required when a center point or set of route points are not specified. The geographic area to display on the map. Optional. A display layer that renders on top of the imagery set. Optional. The width and height in pixels of the static map output.

CollinsBart Collins Bart imagery.

A rectangular area specified as a bounding box. For more information, see Location and Area Types. Example: 45.219,122.325,47.610,-122.107 The only value for this parameter is TrafficFlow. Example: mapLayer=TrafficFlow A string that contains a width and a height separated by a comma. The width must be between 80 and 900 pixels and the height must be between 80 and 834 pixels. The default map size for static maps is 350 pixels by 350 pixels. Example: mapSize=100,600

mapLayer

ml

mapSize

ms

pushpin

pp

Optional. One or more pushpin locations to display on the map.

A series of values that include a Point value (latitude and longitude) with options to add a label of up to three (3) characters and to specify an icon style. For more information about specifying pushpins, see Pushpin Syntax and Icon Styles. You can specify up to 18 pushpins within a URL and 100 if you use the HTTP POST method and specify the pushpins in the body of the request. See the Examples section for examples.
101

Parameter

Alias

Description

Values

Example: pushpin=47.610,122.107;5;P10 mapMetadata mmd Optional. Specifies whether to return metadata for the static map instead of the image. The static map metadata includes the size of the static map and the placement and size of the pushpins on the static map. One of the following values: 1: Return metadata for the specific image. An image is not returned. 0: Do not return metadata. [default] When you request metadata, the response returns metadata for the map instead of the map image. For more information about the static map metadata, see Static Map Data. Example: mmd=1 query Required. A query string that is used to determine the map location to display. Required. The level of zoom to display. A string that contains query terms for the location of the static map. Example: Seattle%20Center An integer between 1 and 21.

zoomLevel

Some imagery may not be available at all zoom levels for all locations. If imagery is not available at a location, a message is returned in the
ErrorDetails

collection that is part of the common response fields. See Common Response Description for a list of common response fields.

102

Parameter

Alias

Description

Values

Example: 10

Route Parameters
Parameter Alias Descriptio n Values

avoid

Optional. Specifies the road types to minimize or avoid when the route is created for the driving travel mode.

A comma-separated list of values that limit the use of highways and toll roads in the route. In the definitions below, highway also refers to a limited-access highway. If no values are specified, highways and tolls are allowed in the route. highways: Avoids the use of highways in the route. tolls: Avoids the use of toll roads in the route. minimizeHighways: Minimizes (tries to avoid) the use of highways in the route. minimizeTolls: Minimizes (tries to avoid) the use of toll roads in the route.

If you specify more than one option for a road type, then the most restrictive option is used. For example, if you set the avoid parameter to both highways and minimizeHighways, the highways option is used and all highways are avoided. Examples: avoid=highways avoid=highways,tolls distanceBeforeFirstTu rn dbft Optional. Specifies the distance before the An integer distance specified in meters. Use this parameter to make sure that the moving vehicle has enough distance to make the first turn. Examples:

103

Parameter

Alias

Descriptio n

Values

first turn is distanceBeforeFirstTurn=500 allowed in dbft=500 the route. This option only applies to the driving travel mode. dateTime dt Required when the travel mode is Transit. The timeType parameter identifies the desired transit time, such as arrival time or departure time. The transit time type is specified by the timeType parameter . Optional. Specifies the maximum number of A string that contains the date and time formatted as a DateTime value. For information about the string representation options for DateTime values, see DateTime.Parse Method (String). Examples: dateTime=03/01/2011 05:42:00 dateTime=05:42:00 [assumes the current day] dateTime=03/01/2011 [assumes the current time]

maxSolutions

maxSoln s

A string that contains an integer value. The default value is 1. Example: maxSolns=3

104

Parameter

Alias

Descriptio n

Values

transit routes to return. optimize optmz Optional. Specifies what parameter s to use to optimize the route on the map.

This parameter is only supported for the Transit travel mode. One of the following values: distance: The route is calculated to minimize the distance. Traffic information is not used. time [default]: The route is calculated to minimize the time. Traffic information is not used. timeWithTraffic: The route is calculated to minimize the time and uses current traffic information.

Example: optimize=time timeType tt Required when the travel mode is Transit. Specifies how to interpret the date and transit time value that is specified by the dateTime parameter . Optional. The mode of travel for the route. wp.n Required. Specifies two or One of the following values: Arrival: The dateTime parameter contains the desired arrival time for a transit request. Departure: The dateTime parameter contains the desired departure time for a transit request. LastAvailable: The dateTime parameter contains the latest departure time available for a transit request.

travelMode

One of the following values: Driving [default] Walking Transit

waypoint.n

A waypoint location can be specified as a Point, a landmark, or an address. For more information about Point values, see Location and Area
105

Parameter

Alias

Descriptio n

Values

more locations that define the route and that are in sequential order.

Types. The index (n value) for the set of waypoints in an integer starting with 0 or 1. The waypoint index values must be sequential and must always increment by 1. You can have a maximum of 25 waypoints. Examples: waypoint.1=47.610,-122.107 [Point] wp.1=Seattle,WA [landmark] waypoint.1=1 Microsoft%20Way%20Redmond WA [address] Incorrect set of waypoints. The following set of values is not valid because there is no waypoint.2. &waypoint.1=San%20Francisco&waypoint.3=Se attle

Response
Static images are returned in one of the following formats. You can specify the image format by setting the format parameter. Default image formats and the corresponding content-type values returned in the response (such as image/png) are defined below. PNG (image/png): Default image format for Collins Bart and Ordnance Survey imagery. JPEG (image/jpeg): Default image format for road, aerial and aerial-with-labels imagery. GIF (image/gif)

These URLs support JSON (application/json) and XML (application/xml) response formats. A JSON response is provided by default unless you request XML output by setting the output (o) parameter. For more information, see Output Parameters.

Examples
Get a map with Road imagery and traffic flow based on a query. This example gets a map with road imagery based on a query result for the Space Needle in Seattle, Washington. Traffic flow is also included on the map.
http://dev.virtualearth.net/REST/V1/Imagery/Map/Road/space%20needle%20seattle?mapLayer=Tr afficFlow&key=BingMapsKey

106

This example returns the following image.

Get a map with Aerial imagery based on a query. This example gets a map with aerial imagery and labels based on a query result for the Eiffel Tower in Paris. The map has a width of 800 pixels and height of 600 pixels.
http://dev.virtualearth.net/REST/v1/Imagery/Map/AerialWithLabels/eiffel%20tower?mapSize=8 00,600&key=BingMapsKey

This example returns the following image.

107

Get a map with Road imagery and pushpins that is centered at a specified point. This example creates a map with road imagery and places pushpins on the Space Needle, the Pacific Science Center, and the Olympic Sculpture Park in Seattle. The centerPoint of the map is set to 47.619048 degrees latitude and -122.35384 degrees longitude. The zoomLevel is set to 15.
http://dev.virtualearth.net/REST/v1/Imagery/Map/Road/47.619048,122.35384/15?mapSize=500,500&pp=47.620495,-122.34931;21;AA&pp=47.619385,122.351485;;AB&pp=47.616295,-122.3556;22&key=BingMapsKey

This example returns the following image.

108

Get the static map metadata for a map with Road imagery and pushpins that is centered at a specified point. This example specifies the same map parameters as the previous example and adds the mapMetadata parameter to get the map metadata. Map metadata includes the map size, area and center point and the position and size of the pushpins. To see the XML and JSON responses for this request and for descriptions of the metadata information, see Static Map Data.
http://dev.virtualearth.net/REST/v1/Imagery/Map/Road/47.619048,122.35384/15?mapSize=500,500&pp=47.620495,-122.34931;21;AA&pp=47.619385,122.351485;;AB&pp=47.616295,-122.3556;22&mapMetadata=1&o=xml&key=BingMapsKey

109

Get a map with Road imagery and declutter overlapping pushpins. This example creates a map with road imagery and specifies two pushpins that are located very close together. The declutterPins (dcl) parameter is set so that the pushpins both appear separately. If the declutterPins parameter were not set, the pushpins would overlap. Maps for both cases are shown below.
http://dev.virtualearth.net/REST/v1/Imagery/Map/Road/47.6156352,122.2043549/12?pp=47.6156352,-122.2043549;;1&pp=47.612441,122.204533;;2&dcl=1&key=BingMapsKey

This example returns the following image.

If the declutter parameter was not set in this example, the pushpins would overlap as shown in the following image.

110

Get a map with Aerial imagery and pushpins without specifying a map area or center point. The map is optimized to fit the pushpins. This example creates a map with aerial imagery with labels and specifies 5 pushpins. Because a map area or center point is not specified, a map area is chosen that best shows all of the pushpins.
http://dev.virtualearth.net/REST/v1/Imagery/Map/AerialWithLabels?pp=40.804000,74.464460;;1&pp=40.815180,-74.219250;;2&pp=40.881210,-74.168020;;3&pp=40.810830,74.260250;;4&pp=40.851800,-74.299900;;5&key=BingMapsKey

This example returns the following image.

111

Get a map with Road imagery for a specified map area. This example gets a map of the specified area that shows road imagery with traffic flow. The map shows the San Francisco metropolitan area and pushpins identify the location of Stanford University and the University of California at Berkeley.
http://dev.virtualearth.net/REST/V1/Imagery/Map/road?mapArea=37.317227,122.318439,37.939081,-122.194565&ms=500,600&pp=37.869505,-122.2705;35;BK&pp=37.428175,122.169680;;ST&ml=TrafficFlow&key=BingMapsKey

This example returns the following image.

112

Get a map with Road imagery that displays a route. This example gets a map with road imagery that displays a driving route between the cities of Seattle and Redmond in Washington State.

113

http://dev.virtualearth.net/REST/v1/Imagery/Map/Road/Routes?wp.0=Seattle,WA&wp.1=Redmond, WA&key=BingMapsKey

This example returns the following image.

Get a map with Road imagery centered at a point with a specified zoom level. This example uses a center point and zoom level to get a map that shows the end of the route between Seattle and Redmond from the previous example. The center point is the latitude and longitude coordinates of Redmond. You can use the Find a Location by Address API to get the latitude and longitude coordinates of a location.
http://dev.virtualearth.net/REST/v1/Imagery/Map/Road/47.678559869527817,122.13099449872971/14/Routes?wp.0=Seattle,WA&wp.1=Redmond,WA&key=BingMapsKey

This example returns the following image.

114

Get maps with Road imagery that displays a transit route and zoomed views of the start and end points. The following examples show how to get a map with road imagery that displays a transit route from the Space Needle in Seattle, Washington to Bellevue Downtown Park in Bellevue, Washington at 3 PM of the current day. The three URL examples display the entire route and zoomed views of the start and end points of the route. Note that the walking segments of the route are displayed as dotted lines. View of the complete transit route.
http://dev.virtualearth.net/REST/V1/Imagery/Map/Road/Routes/Transit?wp.0=Space%20Needle&w p.1=Bellevue%20Downtown%20Park&timeType=Departure&dateTime=3:00:00PM&output=xml&key=BingM apsKey

115

View the start of the transit route by specifying a center point and zoom level. The center point for this map is the coordinates for the Space Needle that are returned in the response when you request a transit route by using the Calculate a Route API. This map includes a walking route that is shown by a dotted line.
http://dev.virtualearth.net/REST/v1/Imagery/Map/Road/47.620495,122.34931/15/Routes/Transit?timeType=Departure&dateTime=3:00:00PM&wp.0=Space%20Needle&wp. 1=Bellevue%20Downtown%20Park &key=BingMapsKey

116

View the end of the transit route by specifying a center point and zoom level. The center point for this map is the coordinates of the Bellevue Downtown Park in that is returned in the response when you request a transit route by using the Calculate a Route API. This map includes a walking route that is shown by a dotted line.
http://dev.virtualearth.net/REST/v1/Imagery/Map/Road/47.615635,122.20435/15/Routes/Transit?timeType=Departure&dateTime=3:00:00PM&wp.0=Space%20Needle&wp. 1=Bellevue%20Downtown%20Park&key=BingMapsKey

117

Get a map that displays pushpins by using the HTTP POST Method The following example shows how to request a static map by using the HTTP POST method. When you use this method, you can specify up to 100 pushpins. All pushpins must be in the body of the request. Because the request does not specify a map area or center point and zoom level, the map area is optimized to show all of the pushpins. HTTP POST URL
http://dev.virtualearth.net/REST/v1/Imagery/Map/Road/?key=BingMapsKey

HTTP POST Header You must include the following settings in the HTTP POST Header.
Content-Length: insertLengthOfHTTPBody Content-Type: text/plain; charset=utf-8

HTTP POST Body When specifying pushpins in the request body, you can use a carriage return (\r\n) or an ampersand (&) as a delimiter. The following two examples show these options. Example 1
pp=38.889586530732335,-77.05010175704956;23;LM\r\n 118

pp=38.88772364638439,-77.0472639799118;7;KM\r\n pp=38.890479451480054,-77.04744637012482;1;VM\r\n pp=38.8896854931628,-77.03519403934479;45;WM

Example 2
pp=38.889586530732335,-77.05010175704956;23;LM&pp=38.88772364638439,77.0472639799118;7;KM\r\n pp=38.890479451480054,-77.04744637012482;1;VM&pp=38.8896854931628,77.03519403934479;45;WM

This example returns the following image.

Get a map with Ordnance Survey imagery that is provided in JPEG format.

119

This example shows a map of Trafalgar Square in Great Britain using Ordnance Survey imagery. The static map is returned in JPEG format. If this image format were not specified in the URL, the static map would be returned in the default PNG format.
http://dev.virtualearth.net/REST/v1/Imagery/Map/OrdnanceSurvey/51.506666,0.129436/15?format=jpeg&key=BingMapsKey

This example returns the following image.

Get a map that shows Collins Bart imagery. This example shows a map of Trafalgar Square in Great Britain using Collins Bart imagery.
http://dev.virtualearth.net/REST/v1/Imagery/Map/CollinsBart/51.506666,0.129436/15?key=BingMapsKey

This example returns the following image.

120

HTTP Status Codes


For more details about these HTTP status codes, see Status Codes and Error Handling. When the request is successful, the following HTTP status code is returned. 200 400 401 404 500 503 When the request is not successful, the response returns one of the following errors.

Get Imagery Metadata


Use the following URL templates to get metadata for imagery that is hosted by Bing Maps. The imagery metadata returned includes URLs and dimensions for imagery tiles, ranges of zoom levels, and imagery vintage information. Uses of this metadata include the following: Determine the vintage of the imagery at a location. Determine the availability of imagery at a location at a specified zoom level. Determine the availability of different types of imagery at a location. Build custom maps by stitching together imagery tiles.
121

URL Templates
These templates support both HTTP and HTTPS protocols. There are two types of imagery metadata URLs: Complete Metadata URLs: Get imagery information that includes a map tile. Basic Metadata URL: Get imagery information that does not include a map tile.

Complete Metadata URLs Get the metadata for an imagery set.

This template is not applicable for Birdseye imagery because Birdseye imagery requires a location.
http://dev.virtualearth.net/REST/v1/Imagery/Metadata/imagerySet?key=BingMapsKey

Get the metadata for an imagery set at a specific location.


http://dev.virtualearth.net/REST/v1/Imagery/Metadata/imagerySet/centerPoint?orientation=o rientation&zoomLevel=zoomLevel&include=ImageryProviders&key=BingMapsKey

Basic Metadata URL

This URL returns all imagery metadata except for the map tile URL. Get only the basic metadata for an imagery set at a specific location. This URL does not return a map tile URL.
http://dev.virtualearth.net/REST/v1/Imagery/BasicMetadata/imagerySet/centerPoint?orientat ion=orientation&zoomLevel=zoomLevel&include=ImageryProviders&key=BingMapsKey

Template Parameters

See the Common Parameters and Types section for additional common parameters to use with these URLs. Common parameters include: Output Parameters: Includes response output types and the JSON callback parameters. Culture Parameter: Includes a list of the supported cultures. When an alias is provided, you can use the alias to shorten the length of the query parameter. For example, zoomLevel=10 can be shortened to zl=10. Parameter values are not case-sensitive.

122

Parameters

Alias

Description

Values

imagerySet

Required. The type of imagery for which you are requesting metadata.

Aerial - Aerial imagery. AerialWithLabels - Aerial imagery with a road overlay. Birdseye - Birds eye (obliqueangle) imagery BirdseyeWithLabels - Birds eye imagery with a road overlay. Road - Roads without additional imagery. Example: imagerySet=Birdseye

centerPoint

Required when imagerySet is Birdseye or BirdseyeWithLabels. Optional for other imagery sets. The center point to use for the imagery metadata. incl Optional. Specifies to provide additional information about the imagery as part of the response.

A point on the earth specified by latitude and longitude coordinates. For more information about point values, see Location and Area Types. Example: 47.610,-122.107 The only option for this parameter is ImageryProviders. When this parameter value is specified, information about the imagery providers is returned in the response. Example: include=ImageryProviders

include

orientation

dir

Optional. The orientation of the viewport to use for the imagery metadata. This option only applies to Birdseye imagery. Required if a centerPoint is specified and imagerySet is set to Road, Aerial or AerialWithLabels The

A double value between 0 to 360, where 0 = North [default], 90 = East, 180 = South, 270 = West. Example: orientation=253.21 An integer between 1 and 21.

zoomLevel

zl

Some imagery may not be available at all


123

Parameters

Alias

Description

Values

level of zoom to use for the imagery metadata.

zoom levels for all locations. If imagery is not available at a location, a message is returned in the
ErrorDetails

collection of the response. For more information about this collection, see Common Response Description. Example: zoomLevel=10

Response
When metadata for Birdseye or BirdseyeWithLabels imagery is requested, a BirdseyeMetadata resource is returned in the response. For other imagery types, an ImageryMetadata resource is returned. The ImageryMetadata resource may contain a map tile URL. For more information about the map tile URL and other metadata returned, see Imagery Metadata. For more information about the common response syntax for the Bing Maps REST Services, see Common Response Description. JSON and XML responses are provided for the URL examples in the following section. These URLs support JSON (application/json) and XML (application/xml) response formats. A JSON response is provided by default unless you request XML output by setting the output (o) parameter. For more information, see Output Parameters.

Examples
Get Aerial imagery metadata at street level. This example returns metadata for aerial imagery metadata at street level in New York City. Note that a center point and a zoom level are both specified. If only one of these values were specified, this URL would return an error. The response is requested in XML format.
http://dev.virtualearth.net/REST/V1/Imagery/Metadata/Aerial/40.714550167322159,74.007124900817871?zl=15&o=xml&key=BingMapsKey

BasicMetadata option: If you requested basic metadata only instead of the complete metadata by using the corresponding basic metadata URL template, the ImageUrl field would not be included. The rest of the response is the same. XML Response

124

This example returns the following XML response. For more information about the response fields including the image URL (map tile URL), see Common Response Description and Imagery Metadata.
<Response xmlns:xsi="http://www.w3.org/2001/XMLSchema instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/search/local/ws/rest/v1"> <Copyright>Copyright 2010 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.</Copyright> <BrandLogoUri>http://dev.virtualearth.net/Branding/logo_powered_by.png</BrandLogoUri> <StatusCode>200</StatusCode> <StatusDescription>OK</StatusDescription> <AuthenticationResultCode>ValidCredentials</AuthenticationResultCode> <TraceId>1a0d6dd60ea94171b8444a9e6e4555ca</TraceId> <ResourceSets> <ResourceSet> <EstimatedTotal>1</EstimatedTotal> <Resources> <ImageryMetadata>

<ImageUrl>http://ecn.t3.tiles.virtualearth.net/tiles/a032010110123333.jpeg?g=471&mkt={cul ture}}</ImageUrl> <ImageWidth>256</ImageWidth> <ImageHeight>256</ImageHeight> <ZoomMin>15</ZoomMin> <ZoomMax>15</ZoomMax> <VintageStart>2006-09-01</VintageStart> <VintageEnd>2006-12-31</VintageEnd> </ImageryMetadata> </Resources> </ResourceSet> </ResourceSets> </Response>

JSON Response
125

The following JSON response contains the same information as the XML response and is provided when the output (o) parameter is not set.
{ "authenticationResultCode":"ValidCredentials", "brandLogoUri":"http:\/\/dev.virtualearth.net\/Branding\/logo_powered_by.png", "copyright":"Copyright 2010 Microsoft and its suppliers. All rights reserved. This A PI cannot be accessed and the content and any results may not be used, reproduced or tran smitted in any manner without express written permission from Microsoft Corporation.", "resourceSets":[ { "estimatedTotal":1, "resources":[ { "__type":"ImageryMetadata:http:\/\/schemas.microsoft.com\/search\/local\/w s\/rest\/v1", "imageHeight":256, "imageUrl":"http:\/\/ecn.t3.tiles.virtualearth.net/tiles/a032010110123333. jpeg?g=471&mkt={culture}}", "imageUrlSubdomains":null, "imageWidth":256, "imageryProviders":null, "vintageEnd":"31 Jan 2006 GMT", "vintageStart":"01 Jan 2006 GMT", "zoomMax":15, "zoomMin":15 } ] } ], "statusCode":200, "statusDescription":"OK", "traceId":"dfd1a6a2c33f414abf9f41d84ed02404" }

Get Road imagery metadata. This example gets metadata for road imagery. The response is requested in XML format.
126

http://dev.virtualearth.net/REST/V1/Imagery/Metadata/Road?output=xml&key=BingMapsKey

BasicMetadata option: If you requested basic metadata only instead of the complete metadata by using the corresponding basic metadata URL template, the ImageUrl field would not be included. The rest of the response is the same. XML Response This example returns the following XML response. For more information about the response and resource fields including the image URL (map tile URL), see Common Response Description and Imagery Metadata.
<Response xmlns:xsi="http://www.w3.org/2001/XMLSchema instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/search/local/ws/rest/v1"> <Copyright>Copyright 2010 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.</Copyright> <BrandLogoUri>http://dev.virtualearth.net/Branding/logo_powered_by.png</BrandLogoUri> <StatusCode>200</StatusCode> <StatusDescription>OK</StatusDescription> <AuthenticationResultCode>ValidCredentials</AuthenticationResultCode> <TraceId>648b2fb028574e159a999015b3a83b87</TraceId> <ResourceSets> <ResourceSet> <EstimatedTotal>1</EstimatedTotal> <Resources> <ImageryMetadata>

<ImageUrl>http://ecn.{subdomain}.tiles.virtualearth.net/tiles/r{quadkey}.jpeg?g=129&mkt={ culture}&shading=hill&stl=H</ImageUrl> <ImageUrlSubdomains> <string>t0</string> <string>t1</string> <string>t2</string> <string>t3</string> </ImageUrlSubdomains> <ImageWidth>256</ImageWidth> <ImageHeight>256</ImageHeight> 127

<ZoomMin>1</ZoomMin> <ZoomMax>21</ZoomMax> </ImageryMetadata> </Resources> </ResourceSet> </ResourceSets> </Response>

JSON Response The following JSON response contains the same information as the XML response and is provided when the output (o) parameter is not set.
{ "authenticationResultCode":"ValidCredentials", "brandLogoUri":"http:\/\/dev.virtualearth.net\/Branding\/logo_powered_by.png", "copyright":"Copyright 2010 Microsoft and its suppliers. All rights reserved. This A PI cannot be accessed and the content and any results may not be used, reproduced or tran smitted in any manner without express written permission from Microsoft Corporation.", "resourceSets":[ { "estimatedTotal":1, "resources":[ { "__type":"ImageryMetadata:http:\/\/schemas.microsoft.com\/search\/local\/w s\/rest\/v1", "imageHeight":256,

"imageUrl":"http:\/\/ecn.{subdomain}.tiles.virtualearth.net/tiles/r{quadkey}.jpeg?g=129&m kt={culture}&shading=hill&stl=H" "imageUrlSubdomains":[ "t0", "t1", "t2", "t3" ], "imageWidth":256, "imageryProviders":null, 128

"vintageEnd":null, "vintageStart":null, "zoomMax":19, "zoomMin":1 } ] } ], "statusCode":200, "statusDescription":"OK", "traceId":"d709a168fde44fe496dcbfafd829185d" }

Get Birdseye imagery metadata. This example gets metadata for Birdseye imagery of San Francisco. The response is requested in XML format.
http://dev.virtualearth.net/REST/V1/Imagery/Metadata/Birdseye/37.779160067439079,122.42004945874214?o=xml&key=BingMapsKey

BasicMetadata option: If you requested basic metadata only instead of the complete metadata by using the corresponding basic metadata URL template, the ImageUrl field would not be included. The rest of the response is the same. XML Response This example returns the following XML response. For more information about the response fields including the image URL (map tile URL), see Common Response Description and Imagery Metadata.
<Response xmlns:xsi="http://www.w3.org/2001/XMLSchema instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/search/local/ws/rest/v1"> <Copyright>Copyright 2010 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.</Copyright> 129

<BrandLogoUri>http://dev.virtualearth.net/Branding/logo_powered_by.png</BrandLogoUri> <StatusCode>200</StatusCode> <StatusDescription>OK</StatusDescription> <AuthenticationResultCode>ValidCredentials</AuthenticationResultCode> <TraceId>d565c0dda37d4b74b293f87bb07a843c</TraceId> <ResourceSets> <ResourceSet> <EstimatedTotal>1</EstimatedTotal> <Resources> <BirdseyeMetadata> <ImageUrl> http://ecn.{subdomain}.tiles.virtualearth.net/tiles/o0230102033310749-{zoom}-{tileId}.jpeg?g=129</ImageUrl> <ImageUrlSubdomains> <string>t0</string> <string>t1</string> <string>t2</string> <string>t3</string> </ImageUrlSubdomains> <ImageWidth>256</ImageWidth> <ImageHeight>256</ImageHeight> <ZoomMin>19</ZoomMin> <ZoomMax>20</ZoomMax> <Orientation>0</Orientation> <TilesX>16</TilesX> <TilesY>12</TilesY> </BirdseyeMetadata> </Resources> </ResourceSet> </ResourceSets> </Response>

JSON Response The following JSON response contains the same information as the XML response and is provided when the output (o) parameter is not set.
130

{ "authenticationResultCode":"ValidCredentials", "brandLogoUri":"http:\/\/dev.virtualearth.net\/Branding\/logo_powered_by.png", "copyright":"Copyright 2010 Microsoft and its suppliers. All rights reserved. This A PI cannot be accessed and the content and any results may not be used, reproduced or tran smitted in any manner without express written permission from Microsoft Corporation.", "resourceSets":[ { "estimatedTotal":1, "resources":[ { "__type":"BirdseyeMetadata:http:\/\/schemas.microsoft.com\/search\/local\/ ws\/rest\/v1", "imageHeight":256, "imageUrl":"http:\/\/ecn.{subdomain}.tiles.virtualearth.net/tiles/o0230102 0333-10749-{zoom}-{tileId}.jpeg?g=129", "imageUrlSubdomains":[ "t0", "t1", "t2", "t3" ], "imageWidth":256, "imageryProviders":null, "vintageEnd":null, "vintageStart":null, "zoomMax":20, "zoomMin":19, "orientation":0, "tilesX":16, "tilesY":12 } ] }

131

], "statusCode":200, "statusDescription":"OK", "traceId":"79cdbd530cdc4bbfaee4c8f8d780d1e3" }

Get Road imagery metadata and imagery provider information. This example returns road imagery metadata and requests information about the imagery providers. The response is returned in JSON format. You can specify to return the response in XML format by setting the output parameter to xml.
http://dev.virtualearth.net/REST/v1/Imagery/Metadata/Road?incl=ImageryProviders&key=BingM apKey

Get Birdseye imagery metadata centered at a point. This example returns Birdseye imagery metadata for imagery that is centered at the specified point. The response is returned in JSON format. You can specify to return the response in XML format by setting the output parameter to xml.
http://dev.virtualearth.net/REST/v1/Imagery/Metadata/Birdseye/47.23,122.3?key=BingMapsKey

Get BirdseyeWithLabels imagery metadata centered at a point and from a viewport angle of 90 degrees. The example gets Birdseye imagery metadata for imagery that includes labels and that has an orientation angle of 90 degrees. The imagery is centered at the specified point. The response is returned in JSON format. You can specify to return the response in XML format by setting the output parameter to xml.
http://dev.virtualearth.net/REST/v1/Imagery/Metadata/BirdseyeWithLabels/47.23,122.3?dir=90&key=BingMapsKey

Get Road imagery metadata centered at a point and for a specified zoom level. This example returns road imagery metadata that is centered at the specified point with a zoom level of 10. . The response is returned in JSON format. You can specify to return the response in XML format by setting the output parameter to xml.
http://dev.virtualearth.net/REST/v1/Imagery/Metadata/Road/47.23,122.3?zl=10?key=BingMapsKey

Get Aerial imagery metadata centered at a point and for a specified zoom level.
132

This example returns metadata for aerial imagery that is centered at the specified point with a zoom level of 10. The response is returned in JSON format. You can specify to return the response in XML format by setting the output parameter to xml.
http://dev.virtualearth.net/REST/v1/Imagery/Metadata/Aerial/47.23,122.3?zl=10&key=BingMapsKey

Get AerialWithLabels metadata centered at a point and for a specified zoom level. This example returns metadata for aerial imagery with labels and that is centered at the specified point with a zoom level of 10. The response is returned in JSON format. You can specify to return the response in XML format by setting the output parameter to xml.
http://dev.virtualearth.net/REST/v1/Imagery/Metadata/AerialWithLabels/47.23,122.3?zl=10&key=BingMapsKey

HTTP Status Codes


For more details about these HTTP status codes, see Status Codes and Error Handling. When the request is successful, the following HTTP status code is returned. 200 400 401 500 503 When the request is not successful, the response returns one of the following errors.

See Also
Bing Maps Tile System Building Your Own Tile Server Understanding Scale and Resolution

Imagery Metadata
The response returned by an Imagery Metadata URL request contains a resource that provides imagery metadata information. If the metadata requested is for Birdseye imagery, a Birdseye Metadata resource is returned. For other types of imagery, an Imagery Metadata resource is returned. This topic contains descriptions of the information elements in these resources, followed by JSON and XML examples. For more information about the common response syntax for the Bing Maps REST Services, see Common Response Description.

133

Common Imagery Resource Fields


The following fields are used in both the Imagery Metadata and the Birdseye Metadata resources.
JSON XML Type Description

imageUrl

ImageUrl

URI

One of the following: A URL template for an image tile if a specific point is specified. A general URL template for the specified imagery set.

For more information about the URI placeholder fields that may appear in the image tile, see Understanding the Image URL Placeholders section below. imageUrlSubdomains ImageUrlSubdomains string One or more URL subdomains that may be used when constructing an image tile URL. The width of the image tile. The height of the image tile. The earliest date found in an imagery set or for a specific imagery tile. The latest date found in an imagery set or for a specific imagery tile. The minimum zoom level available for this imagery set.
134

imageWidth imageHeight vintageStart

ImageWidth ImageHeight VintageStart

integer integer DateTime

vintageEnd

VintageEnd

DateTime

zoomMin

ZoomMin

integer

JSON

XML

Type

Description

zoomMax

ZoomMax

integer

The maximum zoom level available for this imagery set.

Birdseye Metadata Resource Fields


These fields are only used only by the Birdseye Metadata resource.
JSON XML Type Description

orientation

Orientation

double

The orientation of the viewport for the imagery metadata in degrees where 0 = North [default], 90 = East, 180 = South, 270 = West. The horizontal dimension of the imagery in number of tiles. The vertical dimension of the imagery in number of tiles.

tilesX

TilesX

integer

tilesY

TilesY

integer

Understanding the Image URL Placeholders


When you request imagery metadata, the image URL field returned in the response specifies a map tile. This map tile can contain one or more of the following placeholders.
URI placeholder Description

{culture}

The culture of the map. The culture value determines the language that is used to display text. For a list of cultures that are supported by the Imagery API, see Culture Parameter. The quadkey of the tile. For information about quadkeys, see Bing Maps Tile System The sub-domain to use to retrieve tiles to allow
135

{quadkey} {subdomain}

URI placeholder

Description

maximum performance for network calls. The value values are t0, t1, t2, or t3. {tileId} {zoom} The ID of the tile. For information about tile IDs, see, Understanding Tiles. The zoom level of the map.

Examples
The following examples show the resources returned by the Imagery Metadata API. Imagery Metadata Resource Example JSON Example
{ "imageHeight":256,

"imageUrl":"http:\/\/ecn.t2.tiles.virtualearth.net\/tiles\/a0212300322.jpeg?g=414&mkt={cu lture}", "imageUrlSubdomains":null, "imageWidth":256, "vintageEnd":"01 Mar 2001 GMT", "vintageStart":"01 Mar 2001 GMT", "zoomMax":10, "zoomMin":10 }

XML Example
<ImageryMetadata>

<ImageUrl>http://ecn.t2.tiles.virtualearth.net/tiles/a0212300322.jpeg?g=414&mkt={culture} </ImageUrl> <ImageWidth>256</ImageWidth> <ImageHeight>256</ImageHeight> <ZoomMin>10</ZoomMin> <ZoomMax>10</ZoomMax> <VintageStart>2001-03-01</VintageStart> <VintageEnd>2001-03-01</VintageEnd> 136

</ImageryMetadata>

Birdseye Imagery Resource Example XML Example


<BirdseyeMetadata> <ImageUrl>http://ecn.{subdomain}.tiles.virtualearth.net/tiles/o02301020333-37448{zoom}-{tileId}.jpeg?g=461</ImageUrl> <ImageUrlSubdomains> <string>t0</string> <string>t1</string> <string>t2</string> <string>t3</string> </ImageUrlSubdomains> <ImageWidth>256</ImageWidth> <ImageHeight>256</ImageHeight> <ZoomMin>19</ZoomMin> <ZoomMax>20</ZoomMax> <Orientation>0</Orientation> <TilesX>16</TilesX> <TilesY>12</TilesY> </BirdseyeMetadata>

JSON Example
{ "authenticationResultCode":"ValidCredentials", "brandLogoUri":"http:\/\/dev.virtualearth.net\/Branding\/logo_powered_by.png", "copyright":"Copyright 2010 Microsoft and its suppliers. All rights reserved. This A PI cannot be accessed and the content and any results may not be used, reproduced or tran smitted in any manner without express written permission from Microsoft Corporation.", "resourceSets":[ { "estimatedTotal":1, "resources":[ { "__type":"BirdseyeMetadata:http:\/\/schemas.microsoft.com\/search\/local\/ ws\/rest\/v1",

137

"imageHeight":256, "imageUrl":"http:\/\/ecn.{subdomain}.tiles.virtualearth.net\/tiles\/o02301 020333-37448-{zoom}-{tileId}.jpeg?g=461 "imageUrlSubdomains":[ "t0", "t1", "t2", "t3" ], "imageWidth":256, "imageryProviders":null, "vintageEnd":null, "vintageStart":null, "zoomMax":20, "zoomMin":19, "orientation":0, "tilesX":16, "tilesY":12 } ] } ], "statusCode":200, "statusDescription":"OK", "traceId":"79cdbd530cdc4bbfaee4c8f8d780d1e3" }

Static Map Data


When you use the Get a Static Map API to request static map image metadata, the response returns a Static Map Metadata resource that contains metadata about the static map including the absolute (latitude and longitude) and relative (with respect to the map) coordinates and size of pushpins, as well as the map area, size and center point. When you request static map metadata, the response does not return the map image. This topic contains descriptions of the static map metadata, followed by JSON and XML examples.

138

For more information about the common response syntax for the Bing Maps REST Services, see Common Response Description.

Static Map Metadata


The following fields are returned when you request image metadata for a static map.
JSON XML Type Description

bbox

BoundingBox

BoundingBox. For more information about the BoundingBox type, see Location and Area Types.

A geographic area that contains the location. A bounding box contains SouthLatitude, WestLongitude, NorthLatitude, and EastLongitude values in units of degrees. The width of static map. The height of the static map.

imageWidth imageHeight mapCenter

ImageWidth ImageHeight MapCenter

integer integer

Point. For more The centerpoint of the information about the static map. Point type, see Location and Area Types. integer collection The zoom level of the static map. A collection of metadata for each pushpin on the static map. See the Pushpin Metadata section below for more information.

zoom pushpinMetadata

Zoom PushpinMetadata

Pushpin Metadata
If a static map contains pushpins, a request for static map metadata returns following information for each pushpin.
139

JSON

XML

Type

Description

point

Point

Point. For more information about the Point type, see Location and Area Types. An x (horizontal) and y (vertical) offset in pixels.

The latitude and longitude coordinates of the pushpin. The placement of the pushpin on the static map that is defined by an offset in pixels from the upper left hand corner of the map. The offset of the top left corner of the pushpin icon with respect to the anchor point. The offset of the bottom right corner of the pushpin icon with respect to the anchor point.

anchor

Anchor

topLeftOffset

TopLeftOffset

An x (horizontal) and y (vertical) offset in pixels.

bottomRightOffset

BottomRightOffset

An x (horizontal) and y (vertical) offset in pixels.

Examples
The following examples show the metadata that is returned for a static map. The static map is also shown for reference. When you request metadata for a static map, the map image is not returned. Static Map Metadata Resource Example The following URL gets static map metadata for the map image. The map image is not returned with static map metadata. XML and JSON static metadata responses are shown below.
http://dev.virtualearth.net/REST/v1/Imagery/Map/Road/47.619048,122.35384/15?mapSize=500,500&pp=47.620495,-122.34931;21;AA&pp=47.619385,122.351485;;AB&pp=47.616295,-122.3556;22&mapMetadata=1&o=xml&key=BingMapsKey

140

This example returns the following response. XML Response


<Response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/search/local/ws/rest/v1"> <Copyright> Copyright 2011 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation. </Copyright>

141

<BrandLogoUri> http://dev.virtualearth.net/Branding/logo_powered_by.png </BrandLogoUri> <StatusCode>200</StatusCode> <StatusDescription>OK</StatusDescription> <AuthenticationResultCode>ValidCredentials</AuthenticationResultCode> <TraceId> d7718f0fa2344b23ad73ac2dd8788eec </TraceId> <ResourceSets> <ResourceSet> <EstimatedTotal>1</EstimatedTotal> <Resources> <StaticMapMetadata> <BoundingBox> <SouthLatitude>47.611833900404896</SouthLatitude> <WestLongitude>-122.36456394195557</WestLongitude> <NorthLatitude>47.626268662877358</NorthLatitude> <EastLongitude>-122.34314918518068</EastLongitude> </BoundingBox> <MapCenter> <Latitude>47.619048</Latitude> <Longitude>-122.35384</Longitude> </MapCenter> <ImageWidth>500</ImageWidth> <ImageHeight>500</ImageHeight> <Zoom>15</Zoom> <Pushpins> <PushpinMetadata> <Point> <Latitude>47.620495</Latitude> <Longitude>-122.34931</Longitude> </Point> <Anchor> 142

<X>355</X> <Y>200</Y> </Anchor> <TopLeftOffset> <X>12</X> <Y>25</Y> </TopLeftOffset> <BottomRightOffset> <X>13</X> <Y>2</Y> </BottomRightOffset> </PushpinMetadata> <PushpinMetadata> <Point> <Latitude>47.619385</Latitude> <Longitude>-122.351485</Longitude> </Point> <Anchor> <X>305</X> <Y>238</Y> </Anchor> <TopLeftOffset> <X>12</X> <Y>28</Y> </TopLeftOffset> <BottomRightOffset> <X>13</X> <Y>0</Y> </BottomRightOffset> </PushpinMetadata> <PushpinMetadata> <Point> <Latitude>47.616295</Latitude> <Longitude>-122.3556</Longitude> 143

</Point> <Anchor> <X>209</X> <Y>345</Y> </Anchor> <TopLeftOffset> <X>8</X> <Y>8</Y> </TopLeftOffset> <BottomRightOffset> <X>8</X> <Y>8</Y> </BottomRightOffset> </PushpinMetadata> </Pushpins> </StaticMapMetadata> </Resources> </ResourceSet> </ResourceSets> </Response>

JSON Response The following response is returned if the output parameter (o=xml) is not specified in the URL or is set to json (o=json).
{ "authenticationResultCode":"ValidCredentials", "brandLogoUri":"http:\/\/dev.virtualearth.net\/Branding\/logo_powered_by.png", "copyright":"Copyright 2011 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.", "resourceSets":[ { "estimatedTotal":1, "resources":[ 144

"__type":"StaticMapMetadata:http:\/\/schemas.microsoft.com\/search\/local\/ws\/rest\/v1", "bbox":[ 47.611833900404896, -122.36456394195557, 47.626268662877358, -122.34314918518068 ], "imageHeight":"500", "imageWidth":"500", "mapCenter":{ "type":"Point", "coordinates":[ "47.619048", "-122.35384" ] }, "pushpins":[ { "anchor":{ "x":"355", "y":"200" }, "bottomRightOffset":{ "x":"13", "y":"2" }, "point":{ "type":"Point", "coordinates":[ "47.620495", "-122.34931" ] 145

}, "topLeftOffset":{ "x":"12", "y":"25" } }, { "anchor":{ "x":"305", "y":"238" }, "bottomRightOffset":{ "x":"13", "y":"0" }, "point":{ "type":"Point", "coordinates":[ "47.619385", "-122.351485" ] }, "topLeftOffset":{ "x":"12", "y":"28" } }, { "anchor":{ "x":"209", "y":"345" }, "bottomRightOffset":{ "x":"8", 146

"y":"8" }, "point":{ "type":"Point", "coordinates":[ "47.616295", "-122.3556" ] }, "topLeftOffset":{ "x":"8", "y":"8" } } ], "zoom":"15" } ] } ], "statusCode":200, "statusDescription":"OK", "traceId":"bfc64b786a054288a4b160743ddfec65" }

Routes API
Use the Routes API to create a route that includes two or more locations and to create routes from major roads. You can create driving or walking routes. Driving routes can include traffic information. You can also overlay routes on map imagery. For information about how to overlay routes on a static map using the Bing Maps REST Services Imagery API, see Get a Static Map.

In this section

147

Calculate a Route

Use these URL templates to get a walking, driving or transit route by specifying a series of waypoints. Use this URL template to return a driving route to a location from major roads in four directions (West, North, East and South). Use this description to understand the results returned in the response to a Routes API request. Use these maneuver descriptions to understand the maneuver types returned in the route response. Use these warning descriptions to understand the warnings returned in the route response.

Calculate Routes from Major Roads

Route Data

Maneuver Types

Warning Types

See Also
Driving Route Example Walking Route Example Transit Route Example Driving Route with Route Path Example Driving Route using Tolerances Example Bing Maps Transit Coverage

Calculate a Route
Use the following URL templates to get a walking, driving or transit route by specifying a series of waypoints. A waypoint is a specified geographical location defined by longitude and latitude that is used for navigational purposes. The route includes information such as route instructions, travel duration, travel distance or transit information. You can also request a set of route points. To overlay a route on a static map by using the Imagery API, see Get a Static Map.

URL Templates
These templates support both HTTP and HTTPS protocols. You can specify up to 25 waypoints for a route. Each set of waypoints creates a separate route leg. Between any two (2) waypoints, you can have up to 10 intermediate viaWayPoints.ViaWaypoints define the route path and do not create route legs.
148

Find a driving route.


http://dev.virtualearth.net/REST/v1/Routes? wayPoint.1=wayPoint1&viaWaypoint.2=viaWaypoint2&waypoint.3=wayPoint3&wayPoint.n=wayPointn &heading=heading&optimize=optimize&avoid=avoidOptions&distanceBeforeFirstTurn=distanceBef oreFirstTurn&maxSolutions=maxSolutions&routePathOutput=routePathOutput&tolerances=toleran ce1,tolerance2,tolerancen&distanceUnit=distanceUnit&key=BingMapsKey

Find a walking, driving or transit route by specifying the mode of travel. For a list of transit agencies, see Bing Maps Transit Coverage. You can request up to three (3) driving or transit route options between two waypoints by using the maxSolutions parameter.
http://dev.virtualearth.net/REST/v1/Routes/travelMode?wayPoint.1=wayPoint1&viaWaypoint.2= viaWaypoint2&waypoint.3=wayPoint3&wayPoint.n=wayPointn&heading=heading&optimize=optimize& avoid=avoidOptions&distanceBeforeFirstTurn=distanceBeforeFirstTurn&timeType=timeType&date Time=dateTime&maxSolutions=maxSolutions&routePathOutput=routePathOutput&tolerances=tolera nce1,tolerance2,tolerancen&distanceUnit=distanceUnit&key=BingMapsKey

Template Parameters

See the Common Parameters and Types section for additional common parameters to use with these URLs. Common parameters include: Output Parameters: Includes response output types and the JSON callback parameters. Culture Parameter: Includes a list of the supported cultures. User Context Parameters: Includes parameters that set user location and viewport values to help determine locations. For example, these values may help prioritize a set of possible locations when you specify a partial address for a waypoint. When an alias is provided, you can use the alias to shorten the length of the query parameter. For example, waypoint.1=47.610,-122.107 can be shortened to wp.1=47.610,-122.107. Parameter values are not case-sensitive.
Parameter Alias Descriptio n Values

waypoint.n viaWaypoint. n

wp.n vwp. n

waypoint. n: Required. Specifies two or more

A route is defined by a set of waypoints and viaWaypoints (intermediate locations that the route must pass through). The index (n value) for the set of waypoints and viaWaypoints is an integer starting with 0 or 1. The waypoint and viaWaypoint index values must be sequential and must always increment by 1.
149

Parameter

Alias

Descriptio n

Values

locations that define the route and that are in sequential order.

Both waypoint and viaWaypoint locations can be specified as a Point, a landmark, or an address. For more information about Point values, see Location and Area Types. You can have a maximum of 25 waypoints, and a maximum of 10 viaWaypoints between each set of waypoints. The start and end points of the route cannot be viaWaypoints.

For transit routes and when more than one route is viaWaypo requested (maxSolutions > 1), you must specify only two int.n: waypoints, and viaWaypoints are not supported. Optional Specifies If you specify a waypoint or viaWaypoint as an one or address or landmark, you can increase the accuracy more of the corresponding geocoded location (latitude and locations longitude) by specifying an IP address, user location that define or map area in the URL request. For more intermedia information about these parameters, see User te points Context Parameters. of a route between In addition, if you are using the Routes API from waypoints. server-side code, you can set the userIP parameter to 127.0.0.1 (localhost) to prevent the servers location from affecting the geocoded location result. Examples: waypoint.1=47.610,-122.107 [Point] wp.1=Seattle,WA [landmark] waypoint.1=1%20Microsoft%20Way%20Redmond%20WA% 20 [address] &waypoint.1=Seattle&viaWaypoint.2=Kirkland&waypoint.3=R edmond [viaWaypoint] Incorrect set of waypoints. The following set of values is not valid because there is no waypoint.2. &waypoint.1=San%20Francisco&waypoint.3=Seattle The following set of values is not valid because a viaWaypoint is specified as the starting waypoint. &viaWaypoint.1=1%20Microsoft%20Way%20Redmond%20 WA&waypoint.2=Bellevue&waypoint.3=Seattle

150

Parameter

Alias

Descriptio n

Values

avoid

Optional. Specifies the road types to minimize or avoid when a route is created for the driving travel mode.

A comma-separated list of values from the following list that limit the use of highways and toll roads in the route. In the definitions below, highway also refers to a limited-access highway. If no values are specified, highways and tolls are allowed in the route. highways: Avoids the use of highways in the route. tolls: Avoids the use of toll roads in the route. minimizeHighways: Minimizes (tries to avoid) the use of highways in the route. minimizeTolls: Minimizes (tries to avoid) the use of toll roads in the route.

If you specify more than one option for a road type, then the most restrictive option is used. For example, if you set the avoid parameter to both highways and minimizeHighways, the highways option is used and all highways are avoided. Examples: avoid=highways avoid=highways,tolls distanceBefor dbft eFirstTurn Optional. Specifies the distance before the first turn is allowed in the route. This option only applies to the driving travel mode. Optional. An integer distance specified in meters. Use this parameter to make sure that the moving vehicle has enough distance to make the first turn. Examples: distanceBeforeFirstTurn=500 dbft=500

heading

hd

An integer value between 0 and 359 that represents degrees


151

Parameter

Alias

Descriptio n

Values

Specifies the initial heading for the route.

from north where north is 0 degrees and the heading is specified clockwise from north. For example, setting the heading of 270 degrees creates a route that initially heads west. Example: heading=90

optimize

optm z

Optional. Specifies what parameter s to use to optimize the route.

One of the following values: distance: The route is calculated to minimize the distance. Traffic information is not used. time [default]: The route is calculated to minimize the time. Traffic information is not used. timeWithTraffic: The route is calculated to minimize the time and uses current traffic information.

Example: optimize=time routePathOut put rpo Optional. Specifies whether the response should include informatio n about Point (latitude and longitude) values for the routes path. One of the following values: Points: A list of Point values for the routes path is provided in the response. None [default]: No information about the routes path is provided in the response.

Example: routePathOutput=Points

tolerances

tl

Optional. Specifies a series of tolerance values. Each value

A set of comma-separated double values. Each value specifies a tolerance that is used to reduce the number of points needed to display a route on a map and still maintain the route shape. If a point is removed and the new route still falls within the specified tolerance of the old route, then the point is not included in the subset of points returned for that tolerance.
152

Parameter

Alias

Descriptio n

Values

produces a subset of points that approxima tes the route that is described by the full set of points.

You may find it useful to define tolerances for different zoom levels, screen resolutions or other display parameters. You can specify a maximum of seven (7) tolerance values.

The tolerance is specified in degrees. A degree of latitude is approximately 60 nautical miles, 111 kilometers or 69 statute miles. Therefore, a tolerance value of 0.00001 represents a distance of about one (1) meter in the north-south direction. The distance represented by a degree of longitude varies with latitude. For example at 45 degrees of longitude, a degree of latitude is 111.132 km and a degree of longitude is 78.847 km. At the equator, these values are almost equal with latitude at 100.754 km and longitude at 111.320 km. As This you approach the poles, the distance associated with a parameter degree of latitude decreases, and fewer points will be is only excluded for the same tolerance value. For more information valid when about how longitude distances change with latitude, see the Longitude (Wikipedia). routePath The following diagram illustrates how a tolerance value is Output used. parameter is set to Points.

Example: tl=0.00000344978 distanceUnit du Optional. The units to use for distance in the One of the following values: Mile or mi Kilometer or km [default]

Example: distanceUnit=mi
153

Parameter

Alias

Descriptio n

Values

response. dateTime dt Required when the travel mode is Transit. The timeType parameter identifies the desired transit time, such as arrival time or departure time. The transit time type is specified by the timeType parameter . Required when the travel mode is Transit Specifies how to interpret the date and transit time value that is specified by the A string that contains the date and time formatted as a DateTime value. For information about the string representation options for DateTime values, see DateTime.Parse Method (String). Examples: dateTime=03/01/2011 05:42:00 dateTime=05:42:00 [assumes the current day] dateTime=03/01/2011 [assumes the current time]

timeType

tt

One of the following values: Arrival: The dateTime parameter contains the desired arrival time for a transit request. Departure: The dateTime parameter contains the desired departure time for a transit request. LastAvailable: The dateTime parameter contains the latest departure time available for a transit request.

154

Parameter

Alias

Descriptio n

Values

dateTime parameter . maxSolutions max Optional. Solns Specifies the maximum number of transit or driving routes to return. A string that contains an integer value between 1 and 3. The default value is 1. Example: maxSolns=3

This parameter is available for the Driving and Transit travel modes for routes between two waypoints. This parameter does not support routes with more than two waypoints. For driving routes, you must not set the avoid and distanceBeforeFirstTurn parameters. The maxSolutions parameter is supported for routes in the United States, Canada, Mexico, United Kingdom, Australia, and India.

travelMode

Optional. The mode of travel for the route.

One of the following values: Driving [default] Walking Transit

Response
A Route resource is returned when you make a request with one of the following URLs. For more information about the Route resource, see Route Data. For more information about the common response syntax for the Bing Maps REST Services, see Common Response Description. JSON and XML responses are provided for the URL examples in the following section. These URLs support JSON (application/json) and XML (application/xml) response formats. A JSON response is provided by default, unless you request XML output by setting the output (o) parameter. For more information, see Output Parameters.

Examples
Find a driving route. The following example shows how to request a driving route between two locations that minimizes the use of toll roads. To view the complete XML and JSON responses, see Driving Route Example.
155

http://dev.virtualearth.net/REST/V1/Routes/Driving?o=xml&wp.0=london&wp.1=leeds&avoid=min imizeTolls&key=BingMapsKey

Find a driving route that includes an intermediate route point (viaWaypoint). The following example shows how to request a driving route between two locations that includes an intermediate viaWaypoint. ViaWaypoints are used to direct a route through specific locations and do not create a new route leg like waypoints.
http://dev.virtualearth.net/REST/V1/Routes/Driving?o=xml&wp.0=Seattle,WA&vwp.1=Portland,O R&wp.2=Bend,OR&avoid=minimizeTolls&key=BingMapsKey

Find a walking route that minimizes distance. This example returns a walking route from the Eiffel Tower to the Louvre Museum in Paris, France. The route is optimized for distance and returns the results in XML. To view the complete XML and JSON responses, see Walking Route Example.
http://dev.virtualearth.net/REST/V1/Routes/Walking?wp.0=Eiffel%20Tower&wp.1=louvre%20muse um&optmz=distance&output=xml&key=BingMapsKey

Find a transit route. The following example shows how to request a transit route between the Golden Gate Bridge and Fishermans Wharf in San Francisco for 3 PM on the current day. To view the complete XML and JSON responses, see Transit Route Example.
%http://dev.virtualearth.net/REST/V1/Routes/Transit?wp.0=Golden%20Gate%20Bridge&wp.1=Fish ermans%20Wharf&timeType=Departure&dateTime=3:00:00PM&output=xml&key=BingMapsKey

Find up to three driving route options between New York, NY and Philadelphia, PA. The following example requests up to three (3) driving route options between New York, New York and Philadelphia, Pennsylvania.
http://dev.virtualearth.net/REST/V1/Routes?wp.0=New%20York,NY&wp.1=Philadelphia,PA&maxSol ns=3&key=BingMapsKey

Two ways to specify waypoints for a driving route: Point (latitude and longitude coordinates) and location names. The following two examples show how to request a route between San Francisco and San Diego by using latitude and longitude coordinates and by using location names.
http://dev.virtualearth.net/REST/V1/Routes?wp.0=37.779160067439079,122.42004945874214&wp.1=32.715685218572617,-117.16172486543655&key=BingMapsKey http://dev.virtualearth.net/REST/V1/Routes?wp.0=San%20Francisco&wp.1=San%20Diego&key=Bing MapsKey

Find a driving route between Redmond, Washington and Seattle, Washington that specifies an initial heading of 90 degrees (east) and that requests the results uses miles as the distance unit.
http://dev.virtualearth.net/REST/v1/Routes/Driving?waypoint.0=redmond&heading=90&waypoint .1=seattle&du=mi&key=BingMapsKey 156

Find a walking route between two addresses. This example shows how to request a walking route between two addresses.
http://dev.virtualearth.net/REST/V1/Routes/Walking?wp.0=11025%20NE%208th%20St%20Bellevue% 20WA&wp.1=700%20Bellevue%20Way%20NE%20Bellevue WA&key=BingMapsKey

Find a driving route that minimizes the distance and specifies that the first turn must be at least 500 meters from the starting point. The following example optimizes a route between two locations for distance. The first turn on the route must be 500 meters or more from the starting point.
http://dev.virtualearth.net/REST/V1/Routes?wp.0=11025%20NE%208th%20St%20Bellevue&wp.1=1%2 0Microsoft%20Way%20Redmond%20WA&optmz=distance&dblt=500&key=BingMapsKey

Find a driving route that minimizes travel time based on current traffic conditions. The following example optimizes a route between two locations and takes the current traffic conditions into account.
http://dev.virtualearth.net/REST/V1/Routes?wp.0=Bellevue,WA&wp.1=Bothell,WA&optmz=timeWit hTraffic&key=BingMapsKey

Find a driving route that does not use highways or toll roads. The following example returns a driving route between the cities of Buffalo and Syracuse in New York State. The avoid parameter specifies to not use toll roads or highways. Therefore, the returned route does not use the interstate highway I-90 which would otherwise be part of the route.
http://dev.virtualearth.net/REST/V1/Routes/Driving?wp.0=Buffalo&wp.1=Syracuse&avoid=tolls ,highways&key=BingMapsKey

Find a driving route and request a route path. This example returns a driving route from the Minneapolis, Minnesota to St. Paul, Minnesota. The route is optimized for distance and requests point values for the routes path. The results ar e returned in JSON. To view the complete XML and JSON responses, see Driving Route with Route Path Example.
http://dev.virtualearth.net/REST/V1/Routes/Driving?wp.0=Minneapolis,MN&wp.1=St%20Paul,MN& optmz=distance&rpo=Points&key=BingMapsKey

Find a driving route and request a route path and alternative sets of points based on tolerance values. This example returns a driving route from the Minneapolis, Minnesota to St. Paul, Minnesota. The route is optimized for distance and requests point values for the routes path. In addition to the full set of route points, a list of tolerances is specified. For each tolerance value, a subset of points is returned in the response. The route defined by each subset of points approximates the route defined by all the points. The difference allowed between the two routes is defined by the
157

tolerance value. To view examples of these subsets of points in the response, see Driving Route using Tolerances Example.
http://dev.virtualearth.net/REST/V1/Routes/Driving?o=xml&wp.0=44.979035,93.26493&wp.1=44.943828508257866,93.09332862496376&optmz=distance&rpo=Points&tl=0.00000344978,0.0000218840,0.000220577,0.0 0188803,0.0169860,0.0950130,0.846703&key=BingMapsKey

HTTP Status Codes


For more details about these HTTP status codes, see Status Codes and Error Handling. When the request is successful, the following HTTP status code is returned. 200 400 401 404 500 503 When the request is not successful, the response returns one of the following errors.

See Also
Driving Route Example Walking Route Example Transit Route Example Driving Route with Route Path Example Driving Route using Tolerances Example

Driving Route Example


The following example shows how to request a driving route between two locations that minimizes the use of toll roads. Responses are shown for both XML and JSON formats.
http://dev.virtualearth.net/REST/V1/Routes/Driving?o=xml&wp.0=lynnwood&wp.1=seattle&avoid =minimizeTolls&key=BingMapsKey

XML Response The response for this example contains a Route resource that provides driving instructions for the route.
<Response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/search/local/ws/rest/v1">

158

<Copyright> Copyright 2011 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation. </Copyright> <BrandLogoUri> http://dev.virtualearth.net/Branding/logo_powered_by.png </BrandLogoUri> <StatusCode>200</StatusCode> <StatusDescription>OK</StatusDescription> <AuthenticationResultCode>ValidCredentials</AuthenticationResultCode> <TraceId> 3caba2105a574ef49cc2053bd8e2ee41 </TraceId> <ResourceSets> <ResourceSet> <EstimatedTotal>1</EstimatedTotal> <Resources> <Route> <Id> v62,i0,a2,cenUS,dAAAAAAAAAAA=,y0,s1,m1,o1,t4,wsEpABBErIfU=~XpeTlJE5rgAAAOABcNkAPwA=~THlubndvb2QsIFdB~~ ~,w2D47BGFTIPU=~XpeTlGF+5wAAAOABhqIAPwA=~U2VhdHRsZSwgV0E=~~~,k1,u </Id> <BoundingBox> <SouthLatitude>47.603559</SouthLatitude> <WestLongitude>-122.331578</WestLongitude> <NorthLatitude>47.825321</NorthLatitude> <EastLongitude>-122.292332</EastLongitude> </BoundingBox> <DistanceUnit>Kilometer</DistanceUnit> <DurationUnit>Second</DurationUnit> <TravelDistance>26.273</TravelDistance> <TravelDuration>1094</TravelDuration>

159

<RouteLeg> <TravelDistance>26.273</TravelDistance> <TravelDuration>1094</TravelDuration> <ActualStart> <Latitude>47.825321</Latitude> <Longitude>-122.292407</Longitude> </ActualStart> <ActualEnd> <Latitude>47.603559</Latitude> <Longitude>-122.329436</Longitude> </ActualEnd> <StartLocation> <Name>Lynnwood, WA</Name> <Point> <Latitude>47.825321</Latitude> <Longitude>-122.292412</Longitude> </Point> <BoundingBox> <SouthLatitude>47.801086</SouthLatitude> <WestLongitude>-122.3414</WestLongitude> <NorthLatitude>47.841423</NorthLatitude> <EastLongitude>-122.286293</EastLongitude> </BoundingBox> <EntityType>PopulatedPlace</EntityType> <Address> <AdminDistrict>WA</AdminDistrict> <AdminDistrict2>Snohomish Co.</AdminDistrict2> <CountryRegion>United States</CountryRegion> <FormattedAddress>Lynnwood, WA</FormattedAddress> <Locality>Lynnwood</Locality> </Address> <Confidence>High</Confidence> <MatchCode>Good</MatchCode> <GeocodePoint> 160

<Latitude>47.825321</Latitude> <Longitude>-122.292412</Longitude> <CalculationMethod>Rooftop</CalculationMethod> <UsageType>Display</UsageType> </GeocodePoint> </StartLocation> <EndLocation> <Name>Seattle, WA</Name> <Point> <Latitude>47.603561</Latitude> <Longitude>-122.329437</Longitude> </Point> <BoundingBox> <SouthLatitude>47.253399</SouthLatitude> <WestLongitude>-123.165718</WestLongitude> <NorthLatitude>47.946136</NorthLatitude> <EastLongitude>-121.503441</EastLongitude> </BoundingBox> <EntityType>PopulatedPlace</EntityType> <Address> <AdminDistrict>WA</AdminDistrict> <AdminDistrict2>King Co.</AdminDistrict2> <CountryRegion>United States</CountryRegion> <FormattedAddress>Seattle, WA</FormattedAddress> <Locality>Seattle</Locality> </Address> <Confidence>High</Confidence> <MatchCode>Good</MatchCode> <GeocodePoint> <Latitude>47.603561</Latitude> <Longitude>-122.329437</Longitude> <CalculationMethod>Rooftop</CalculationMethod> <UsageType>Display</UsageType> </GeocodePoint> 161

</EndLocation> <ItineraryItem> <TravelMode>Driving</TravelMode> <TravelDistance>1.029</TravelDistance> <TravelDuration>97</TravelDuration> <ManeuverPoint> <Latitude>47.825321</Latitude> <Longitude>-122.292407</Longitude> </ManeuverPoint> <Instruction maneuverType="DepartStart">Depart 44TH Ave W toward 192ND St SW</Instruction> <CompassDirection>south</CompassDirection> <Detail> <ManeuverType>DepartStart</ManeuverType> <StartPathIndex>0</StartPathIndex> <EndPathIndex>1</EndPathIndex> <Name>44TH Ave W</Name> <CompassDegrees>180</CompassDegrees> <Mode>Driving</Mode> <PreviousEntityId>0</PreviousEntityId> <NextEntityId>0</NextEntityId> <RoadType>Arterial</RoadType> <LocationCode>114-08912</LocationCode> <LocationCode>114-08911</LocationCode> </Detail> <Exit/> <TollZone/> <TransitTerminus/> <IconType>Auto</IconType> <Time>0001-01-01T00:00:00</Time> <TransitStopId>0</TransitStopId> <TowardsRoadName>192ND St SW</TowardsRoadName> <SideOfStreet>Unknown</SideOfStreet> </ItineraryItem> 162

<ItineraryItem> <TravelMode>Driving</TravelMode> <TravelDistance>24.323</TravelDistance> <TravelDuration>908</TravelDuration> <ManeuverPoint> <Latitude>47.816019</Latitude> <Longitude>-122.292332</Longitude> </ManeuverPoint> <Instruction maneuverType="RampThenHighwayRight">Take ramp right for I-5 South</Instruction> <CompassDirection>southwest</CompassDirection> <Detail> <ManeuverType>TakeRampRight</ManeuverType> <StartPathIndex>1</StartPathIndex> <EndPathIndex>6</EndPathIndex> <CompassDegrees>217</CompassDegrees> <Mode>Driving</Mode> <PreviousEntityId>0</PreviousEntityId> <NextEntityId>0</NextEntityId> <RoadType>Ramp</RoadType> </Detail> <Detail> <ManeuverType>Merge</ManeuverType> <StartPathIndex>6</StartPathIndex> <EndPathIndex>91</EndPathIndex> <Name>I-5 South</Name> <CompassDegrees>241</CompassDegrees> <Mode>Driving</Mode> <PreviousEntityId>0</PreviousEntityId> <NextEntityId>0</NextEntityId> <RoadType>LimitedAccessHighway</RoadType> <RoadShieldRequestParameters> <Bucket>50402</Bucket> <Shield> 163

<RoadShieldType>1</RoadShieldType> <Label>5</Label> </Shield> </RoadShieldRequestParameters> <LocationCode>114-04212</LocationCode> <LocationCode>114N04212</LocationCode> <LocationCode>114-04211</LocationCode> <LocationCode>114N04211</LocationCode> <LocationCode>114-04210</LocationCode> <LocationCode>114N04210</LocationCode> <LocationCode>114-04209</LocationCode> <LocationCode>114N04209</LocationCode> <LocationCode>114-04208</LocationCode> <LocationCode>114N04208</LocationCode> <LocationCode>114-04207</LocationCode> <LocationCode>114N04207</LocationCode> <LocationCode>114-04206</LocationCode> <LocationCode>114N04206</LocationCode> <LocationCode>114-04205</LocationCode> <LocationCode>114N04205</LocationCode> <LocationCode>114-04204</LocationCode> <LocationCode>114N04204</LocationCode> <LocationCode>114-04203</LocationCode> <LocationCode>114N04203</LocationCode> <LocationCode>114-04202</LocationCode> <LocationCode>114N04202</LocationCode> <LocationCode>114-04201</LocationCode> <LocationCode>114N04201</LocationCode> <LocationCode>114-04200</LocationCode> <LocationCode>114N04200</LocationCode> <LocationCode>114-04199</LocationCode> <LocationCode>114N04199</LocationCode> <LocationCode>114-04198</LocationCode> <LocationCode>114N04198</LocationCode> 164

<LocationCode>114-04197</LocationCode> <LocationCode>114N04197</LocationCode> <LocationCode>114-04196</LocationCode> <LocationCode>114N04196</LocationCode> <LocationCode>114-04195</LocationCode> </Detail> <Exit/> <TollZone/> <TransitTerminus/> <IconType>Auto</IconType> <Time>0001-01-01T00:00:00</Time> <TransitStopId>0</TransitStopId> <SideOfStreet>Unknown</SideOfStreet> </ItineraryItem> <ItineraryItem> <TravelMode>Driving</TravelMode> <TravelDistance>0.799</TravelDistance> <TravelDuration>63</TravelDuration> <ManeuverPoint> <Latitude>47.610658</Latitude> <Longitude>-122.33139</Longitude> </ManeuverPoint> <Instruction maneuverType="RampThenHighwayRight"> At exit 165A, take ramp right for 6TH Ave toward James St. </Instruction> <CompassDirection>southeast</CompassDirection> <Detail> <ManeuverType>TakeRampRight</ManeuverType> <StartPathIndex>91</StartPathIndex> <EndPathIndex>96</EndPathIndex> <CompassDegrees>198</CompassDegrees> <Mode>Driving</Mode> <PreviousEntityId>0</PreviousEntityId> <NextEntityId>0</NextEntityId> 165

<RoadType>Ramp</RoadType> </Detail> <Detail> <ManeuverType>Merge</ManeuverType> <StartPathIndex>96</StartPathIndex> <EndPathIndex>98</EndPathIndex> <Name>6TH Ave</Name> <CompassDegrees>140</CompassDegrees> <Mode>Driving</Mode> <PreviousEntityId>0</PreviousEntityId> <NextEntityId>0</NextEntityId> <RoadType>Arterial</RoadType> <LocationCode>114-08569</LocationCode> </Detail> <Sign>James St.</Sign> <Exit>165A</Exit> <TollZone/> <TransitTerminus/> <IconType>Auto</IconType> <Time>0001-01-01T00:00:00</Time> <TransitStopId>0</TransitStopId> <SideOfStreet>Unknown</SideOfStreet> </ItineraryItem> <ItineraryItem> <TravelMode>Driving</TravelMode> <TravelDistance>0.122</TravelDistance> <TravelDuration>23</TravelDuration> <ManeuverPoint> <Latitude>47.604141</Latitude> <Longitude>-122.328081</Longitude> </ManeuverPoint> <Instruction maneuverType="TurnRight">Turn right onto James St</Instruction> <CompassDirection>southwest</CompassDirection> 166

<Detail> <ManeuverType>TurnRight</ManeuverType> <StartPathIndex>98</StartPathIndex> <EndPathIndex>101</EndPathIndex> <Name>James St</Name> <CompassDegrees>246</CompassDegrees> <Mode>Driving</Mode> <PreviousEntityId>0</PreviousEntityId> <NextEntityId>0</NextEntityId> <RoadType>Arterial</RoadType> <LocationCode>114-10561</LocationCode> </Detail> <Exit/> <TollZone/> <TransitTerminus/> <IconType>Auto</IconType> <Time>0001-01-01T00:00:00</Time> <TransitStopId>0</TransitStopId> <SideOfStreet>Unknown</SideOfStreet> </ItineraryItem> <ItineraryItem> <TravelMode>Driving</TravelMode> <TravelDistance>0</TravelDistance> <TravelDuration>0</TravelDuration> <ManeuverPoint> <Latitude>47.603559</Latitude> <Longitude>-122.329436</Longitude> </ManeuverPoint> <Instruction maneuverType="ArriveFinish">Arrive at Seattle, WA</Instruction> <CompassDirection>west</CompassDirection> <Hint>The last intersection is 5TH Ave</Hint> <Hint>If you reach 4TH Ave, you've gone too far</Hint> <Detail> 167

<ManeuverType>ArriveFinish</ManeuverType> <StartPathIndex>101</StartPathIndex> <EndPathIndex>101</EndPathIndex> <Name>James St</Name> <CompassDegrees>249</CompassDegrees> <Mode>Driving</Mode> <PreviousEntityId>0</PreviousEntityId> <NextEntityId>0</NextEntityId> <RoadType>Arterial</RoadType> <LocationCode>114-10561</LocationCode> </Detail> <Exit/> <TollZone/> <TransitTerminus/> <IconType>Auto</IconType> <Time>0001-01-01T00:00:00</Time> <TransitStopId>0</TransitStopId> <SideOfStreet>Unknown</SideOfStreet> </ItineraryItem> <StartTime>0001-01-01T00:00:00</StartTime> <EndTime>0001-01-01T00:00:00</EndTime> </RouteLeg> </Route> </Resources> </ResourceSet> </ResourceSets> </Response>

JSON Response You would receive the following JSON response if the output=xml parameter was not set in this example.
{ "authenticationResultCode":"ValidCredentials", "brandLogoUri":"http:\/\/dev.virtualearth.net\/Branding\/logo_powered_by.png", 168

"copyright":"Copyright 2011 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.", "resourceSets":[ { "estimatedTotal":1, "resources":[ {

"__type":"Route:http:\/\/schemas.microsoft.com\/search\/local\/ws\/rest\/v1", "bbox":[ 47.603559, -122.331578, 47.825321, -122.292332 ], "id":"v62,i0,a2,cenUS,dAAAAAAAAAAA=,y0,s1,m1,o1,t4,wsEpABBErIfU=~XpeTlJE5rgAAAOABcNkAPwA=~THlubndvb2QsIFdB~~ ~,w2D47BGFTIPU=~XpeTlGF+5wAAAOABhqIAPwA=~U2VhdHRsZSwgV0E=~~~,k1,u", "distanceUnit":"Kilometer", "durationUnit":"Second", "routeLegs":[ { "actualEnd":{ "type":"Point", "coordinates":[ 47.603559, -122.329436 ] }, "actualStart":{ "type":"Point", "coordinates":[ 47.825321, 169

-122.292407 ] }, "endLocation":{ "bbox":[ 47.253399, -123.165718, 47.946136, -121.503441 ], "name":"Seattle, WA", "point":{ "type":"Point", "coordinates":[ 47.603561, -122.329437 ] }, "address":{ "adminDistrict":"WA", "adminDistrict2":"King Co.", "countryRegion":"United States", "formattedAddress":"Seattle, WA", "locality":"Seattle" }, "confidence":"High", "entityType":"PopulatedPlace", "geocodePoints":[ { "type":"Point", "coordinates":[ 47.603561, -122.329437 ], 170

"calculationMethod":"Rooftop", "usageTypes":[ "Display" ] } ], "matchCodes":[ "Good" ] }, "itineraryItems":[ { "compassDirection":"south", "details":[ { "compassDegrees":180, "endPathIndices":[ 1 ], "locationCodes":[ "114-08912", "114-08911" ], "maneuverType":"DepartStart", "mode":"Driving", "names":[ "44TH Ave W" ], "roadType":"Arterial", "startPathIndices":[ 0 ] } ], 171

"exit":"", "iconType":"Auto", "instruction":{ "maneuverType":"DepartStart", "text":"Depart 44TH Ave W toward 192ND St SW" }, "maneuverPoint":{ "type":"Point", "coordinates":[ 47.825321, -122.292407 ] }, "sideOfStreet":"Unknown", "tollZone":"", "towardsRoadName":"192ND St SW", "transitTerminus":"", "travelDistance":1.029, "travelDuration":97, "travelMode":"Driving" }, { "compassDirection":"southwest", "details":[ { "compassDegrees":217, "endPathIndices":[ 6 ], "maneuverType":"TakeRampRight", "mode":"Driving", "roadType":"Ramp", "startPathIndices":[ 1 172

] }, { "compassDegrees":241, "endPathIndices":[ 91 ], "locationCodes":[ "114-04212", "114N04212", "114-04211", "114N04211", "114-04210", "114N04210", "114-04209", "114N04209", "114-04208", "114N04208", "114-04207", "114N04207", "114-04206", "114N04206", "114-04205", "114N04205", "114-04204", "114N04204", "114-04203", "114N04203", "114-04202", "114N04202", "114-04201", "114N04201", "114-04200", "114N04200", 173

"114-04199", "114N04199", "114-04198", "114N04198", "114-04197", "114N04197", "114-04196", "114N04196", "114-04195" ], "maneuverType":"Merge", "mode":"Driving", "names":[ "I-5 South" ], "roadShieldRequestParameters":{ "bucket":50402, "shields":[ { "labels":[ "5" ], "roadShieldType":1 } ] }, "roadType":"LimitedAccessHighway", "startPathIndices":[ 6 ] } ], "exit":"", "iconType":"Auto", 174

"instruction":{ "maneuverType":"RampThenHighwayRight", "text":"Take ramp right for I-5 South" }, "maneuverPoint":{ "type":"Point", "coordinates":[ 47.816019, -122.292332 ] }, "sideOfStreet":"Unknown", "tollZone":"", "transitTerminus":"", "travelDistance":24.323, "travelDuration":908, "travelMode":"Driving" }, { "compassDirection":"southeast", "details":[ { "compassDegrees":198, "endPathIndices":[ 96 ], "maneuverType":"TakeRampRight", "mode":"Driving", "roadType":"Ramp", "startPathIndices":[ 91 ] }, { 175

"compassDegrees":140, "endPathIndices":[ 98 ], "locationCodes":[ "114-08569" ], "maneuverType":"Merge", "mode":"Driving", "names":[ "6TH Ave" ], "roadType":"Arterial", "startPathIndices":[ 96 ] } ], "exit":"165A", "iconType":"Auto", "instruction":{ "maneuverType":"RampThenHighwayRight", "text":"At exit 165A, take ramp right for 6TH Ave toward James St." }, "maneuverPoint":{ "type":"Point", "coordinates":[ 47.610658, -122.33139 ] }, "sideOfStreet":"Unknown", "signs":[ 176

"James St." ], "tollZone":"", "transitTerminus":"", "travelDistance":0.799, "travelDuration":63, "travelMode":"Driving" }, { "compassDirection":"southwest", "details":[ { "compassDegrees":246, "endPathIndices":[ 101 ], "locationCodes":[ "114-10561" ], "maneuverType":"TurnRight", "mode":"Driving", "names":[ "James St" ], "roadType":"Arterial", "startPathIndices":[ 98 ] } ], "exit":"", "iconType":"Auto", "instruction":{ "maneuverType":"TurnRight", 177

"text":"Turn right onto James St" }, "maneuverPoint":{ "type":"Point", "coordinates":[ 47.604141, -122.328081 ] }, "sideOfStreet":"Unknown", "tollZone":"", "transitTerminus":"", "travelDistance":0.122, "travelDuration":23, "travelMode":"Driving" }, { "compassDirection":"west", "details":[ { "compassDegrees":249, "endPathIndices":[ 101 ], "locationCodes":[ "114-10561" ], "maneuverType":"ArriveFinish", "mode":"Driving", "names":[ "James St" ], "roadType":"Arterial", "startPathIndices":[ 178

101 ] } ], "exit":"", "hints":[ { "hintType":null, "text":"The last intersection is 5TH Ave" }, { "hintType":null, "text":"If you reach 4TH Ave, you've gone too far" } ], "iconType":"Auto", "instruction":{ "maneuverType":"ArriveFinish", "text":"Arrive at Seattle, WA" }, "maneuverPoint":{ "type":"Point", "coordinates":[ 47.603559, -122.329436 ] }, "sideOfStreet":"Unknown", "tollZone":"", "transitTerminus":"", "travelDistance":0, "travelDuration":0, "travelMode":"Driving" } 179

], "startLocation":{ "bbox":[ 47.801086, -122.3414, 47.841423, -122.286293 ], "name":"Lynnwood, WA", "point":{ "type":"Point", "coordinates":[ 47.825321, -122.292412 ] }, "address":{ "adminDistrict":"WA", "adminDistrict2":"Snohomish Co.", "countryRegion":"United States", "formattedAddress":"Lynnwood, WA", "locality":"Lynnwood" }, "confidence":"High", "entityType":"PopulatedPlace", "geocodePoints":[ { "type":"Point", "coordinates":[ 47.825321, -122.292412 ], "calculationMethod":"Rooftop", "usageTypes":[ 180

"Display" ] } ], "matchCodes":[ "Good" ] }, "travelDistance":26.273, "travelDuration":1094 } ], "travelDistance":26.273, "travelDuration":1094 } ] } ], "statusCode":200, "statusDescription":"OK", "traceId":"6dd02c45856d4c34bad86becee21d2c9" }

Walking Route Example


This example returns a walking route from the Eiffel Tower to the Louvre Museum in Paris, France. The route is optimized for distance. Responses are shown for both XML and JSON formats.
http://dev.virtualearth.net/REST/V1/Routes/Walking?wp.0=Eiffel%20Tower&wp.1=louvre%20muse um&optmz=distance&output=xml&key=BingMapsKey

XML Response The response for this example contains a Route resource that includes a set of route steps for a route leg. The steps are defined as a collection of ItineraryItem values.
<Response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/search/local/ws/rest/v1">

181

<Copyright> Copyright 2011 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation. </Copyright> <BrandLogoUri> http://dev.virtualearth.net/Branding/logo_powered_by.png </BrandLogoUri> <StatusCode>200</StatusCode> <StatusDescription>OK</StatusDescription> <AuthenticationResultCode>ValidCredentials</AuthenticationResultCode> <TraceId> e23356991f5e43e68900cc6147778d9a </TraceId> <ResourceSets> <ResourceSet> <EstimatedTotal>1</EstimatedTotal> <Resources> <Route> <Id> v62,i0,a0,cenUS,dAAAAAAAAAAA=,y0,s1,m2,o2,t0,wEcpXBNw6NAA=~oHj1SFPg4RQAAOABsjz3PgA=~RWlmZmVsIFRvd2VyLC BQYXJpcywgRnJhbmNl~~~,w49ZXBP5BNQA=~oHj1SDG/4RQAAOAB0m39PgA=~TG91dnJlLCBQYXJpcywgRnJhbmNl ~~~,k1,u </Id> <BoundingBox> <SouthLatitude>48.857371</SouthLatitude> <WestLongitude>2.295273</WestLongitude> <NorthLatitude>48.860788</NorthLatitude> <EastLongitude>2.340455</EastLongitude> </BoundingBox> <DistanceUnit>Kilometer</DistanceUnit> <DurationUnit>Second</DurationUnit> <TravelDistance>3.854</TravelDistance> <TravelDuration>2775</TravelDuration> 182

<RouteLeg> <TravelDistance>3.854</TravelDistance> <TravelDuration>2775</TravelDuration> <ActualStart> <Latitude>48.85791</Latitude> <Longitude>2.295273</Longitude> </ActualStart> <ActualEnd> <Latitude>48.860118</Latitude> <Longitude>2.340455</Longitude> </ActualEnd> <StartLocation> <Name>Eiffel Tower, Paris, France</Name> <Point> <Latitude>48.857929</Latitude> <Longitude>2.29526</Longitude> </Point> <BoundingBox> <SouthLatitude>48.85746</SouthLatitude> <WestLongitude>2.2933</WestLongitude> <NorthLatitude>48.859039</NorthLatitude> <EastLongitude>2.29569</EastLongitude> </BoundingBox> <EntityType>Monument</EntityType> <Address> <AdminDistrict>IdF</AdminDistrict> <AdminDistrict2>Paris</AdminDistrict2> <CountryRegion>France</CountryRegion> <FormattedAddress>Eiffel Tower, Paris, France</FormattedAddress> <Locality>Paris</Locality> <Landmark>Eiffel Tower</Landmark> </Address> <Confidence>High</Confidence> <MatchCode>Good</MatchCode> 183

<GeocodePoint> <Latitude>48.857929</Latitude> <Longitude>2.29526</Longitude> <CalculationMethod>Rooftop</CalculationMethod> <UsageType>Display</UsageType> </GeocodePoint> </StartLocation> <EndLocation> <Name>Louvre, Paris, France</Name> <Point> <Latitude>48.86013</Latitude> <Longitude>2.34043</Longitude> </Point> <BoundingBox> <SouthLatitude>48.859371</SouthLatitude> <WestLongitude>2.33046</WestLongitude> <NorthLatitude>48.863522</NorthLatitude> <EastLongitude>2.33995</EastLongitude> </BoundingBox> <EntityType>Museum</EntityType> <Address> <AdminDistrict>IdF</AdminDistrict> <AdminDistrict2>Paris</AdminDistrict2> <CountryRegion>France</CountryRegion> <FormattedAddress>Louvre, Paris, France</FormattedAddress> <Locality>Paris</Locality> <Landmark>Louvre</Landmark> </Address> <Confidence>High</Confidence> <MatchCode>Good</MatchCode> <GeocodePoint> <Latitude>48.86013</Latitude> <Longitude>2.34043</Longitude> <CalculationMethod>Rooftop</CalculationMethod> 184

<UsageType>Display</UsageType> </GeocodePoint> </EndLocation> <ItineraryItem> <TravelMode>Walking</TravelMode> <TravelDistance>0.01</TravelDistance> <TravelDuration>7</TravelDuration> <ManeuverPoint> <Latitude>48.85791</Latitude> <Longitude>2.295273</Longitude> </ManeuverPoint> <Instruction maneuverType="DepartStart"> Depart Avenue Gustave Eiffel toward Avenue Anatole France </Instruction> <CompassDirection>northeast</CompassDirection> <Detail> <ManeuverType>DepartStart</ManeuverType> <StartPathIndex>0</StartPathIndex> <EndPathIndex>1</EndPathIndex> <Name>Avenue Gustave Eiffel</Name> <CompassDegrees>56</CompassDegrees> <Mode>Walking</Mode> <PreviousEntityId>0</PreviousEntityId> <NextEntityId>0</NextEntityId> <RoadType>Street</RoadType> </Detail> <Exit/> <TollZone/> <TransitTerminus/> <IconType>Walk</IconType> <Time>0001-01-01T00:00:00</Time> <TransitStopId>0</TransitStopId> <TowardsRoadName>Avenue Anatole France</TowardsRoadName> <SideOfStreet>Unknown</SideOfStreet> 185

</ItineraryItem> <ItineraryItem> <TravelMode>Walking</TravelMode> <TravelDistance>0.134</TravelDistance> <TravelDuration>96</TravelDuration> <ManeuverPoint> <Latitude>48.857982</Latitude> <Longitude>2.295381</Longitude> </ManeuverPoint> <Instruction maneuverType="KeepStraight">Keep straight onto path</Instruction> <CompassDirection>east</CompassDirection> <Detail> <ManeuverType>KeepStraight</ManeuverType> <StartPathIndex>1</StartPathIndex> <EndPathIndex>4</EndPathIndex> <CompassDegrees>79</CompassDegrees> <Mode>Walking</Mode> <PreviousEntityId>0</PreviousEntityId> <NextEntityId>0</NextEntityId> <RoadType>Street</RoadType> </Detail> <Exit/> <TollZone/> <TransitTerminus/> <IconType>Walk</IconType> <Time>0001-01-01T00:00:00</Time> <TransitStopId>0</TransitStopId> <SideOfStreet>Unknown</SideOfStreet> </ItineraryItem> <ItineraryItem> <TravelMode>Walking</TravelMode> <TravelDistance>0.112</TravelDistance> <TravelDuration>80</TravelDuration> 186

<ManeuverPoint> <Latitude>48.857773</Latitude> <Longitude>2.297081</Longitude> </ManeuverPoint> <Instruction maneuverType="TurnLeftThenBearRight"> Turn left and then bear right onto Alle Adrienne Lecouvreur </Instruction> <CompassDirection>southeast</CompassDirection> <Detail> <ManeuverType>TurnLeft</ManeuverType> <StartPathIndex>4</StartPathIndex> <EndPathIndex>7</EndPathIndex> <CompassDegrees>80</CompassDegrees> <Mode>Walking</Mode> <PreviousEntityId>0</PreviousEntityId> <NextEntityId>0</NextEntityId> <RoadType>Street</RoadType> </Detail> <Detail> <ManeuverType>BearRight</ManeuverType> <StartPathIndex>7</StartPathIndex> <EndPathIndex>9</EndPathIndex> <Name>Alle Adrienne Lecouvreur</Name> <CompassDegrees>123</CompassDegrees> <Mode>Walking</Mode> <PreviousEntityId>0</PreviousEntityId> <NextEntityId>0</NextEntityId> <RoadType>Street</RoadType> </Detail> <Exit/> <TollZone/> <TransitTerminus/> <IconType>Walk</IconType> <Time>0001-01-01T00:00:00</Time> 187

<TransitStopId>0</TransitStopId> <SideOfStreet>Unknown</SideOfStreet> </ItineraryItem> <ItineraryItem> <TravelMode>Walking</TravelMode> <TravelDistance>0.15</TravelDistance> <TravelDuration>108</TravelDuration> <ManeuverPoint> <Latitude>48.857371</Latitude> <Longitude>2.298181</Longitude> </ManeuverPoint> <Instruction maneuverType="BearLeft">Bear left onto Avenue mile Pouvillon</Instruction> <CompassDirection>east</CompassDirection> <Detail> <ManeuverType>BearLeft</ManeuverType> <StartPathIndex>9</StartPathIndex> <EndPathIndex>12</EndPathIndex> <Name>Avenue mile Pouvillon</Name> <CompassDegrees>79</CompassDegrees> <Mode>Walking</Mode> <PreviousEntityId>0</PreviousEntityId> <NextEntityId>0</NextEntityId> <RoadType>Street</RoadType> </Detail> <Exit/> <TollZone/> <TransitTerminus/> <IconType>Walk</IconType> <Time>0001-01-01T00:00:00</Time> <TransitStopId>0</TransitStopId> <SideOfStreet>Unknown</SideOfStreet> </ItineraryItem> <ItineraryItem> 188

<TravelMode>Walking</TravelMode> <TravelDistance>1.77</TravelDistance> <TravelDuration>1274</TravelDuration> <ManeuverPoint> <Latitude>48.85765</Latitude> <Longitude>2.300139</Longitude> </ManeuverPoint> <Instruction maneuverType="RoadNameChange">Road name changes to Rue SaintDominique</Instruction> <CompassDirection>east</CompassDirection> <Detail> <ManeuverType>RoadNameChange</ManeuverType> <StartPathIndex>12</StartPathIndex> <EndPathIndex>21</EndPathIndex> <Name>Rue Saint-Dominique</Name> <CompassDegrees>69</CompassDegrees> <Mode>Walking</Mode> <PreviousEntityId>0</PreviousEntityId> <NextEntityId>0</NextEntityId> <RoadType>Street</RoadType> </Detail> <Exit/> <TollZone/> <TransitTerminus/> <IconType>Walk</IconType> <Time>0001-01-01T00:00:00</Time> <TransitStopId>0</TransitStopId> <SideOfStreet>Unknown</SideOfStreet> </ItineraryItem> <ItineraryItem> <TravelMode>Walking</TravelMode> <TravelDistance>0.703</TravelDistance> <TravelDuration>506</TravelDuration> <ManeuverPoint> 189

<Latitude>48.858159</Latitude> <Longitude>2.322793</Longitude> </ManeuverPoint> <Instruction maneuverType="TurnLeft">Turn left onto Rue de Bellechasse</Instruction> <CompassDirection>northeast</CompassDirection> <Detail> <ManeuverType>TurnLeft</ManeuverType> <StartPathIndex>21</StartPathIndex> <EndPathIndex>25</EndPathIndex> <Name>Rue de Bellechasse</Name> <CompassDegrees>45</CompassDegrees> <Mode>Walking</Mode> <PreviousEntityId>0</PreviousEntityId> <NextEntityId>0</NextEntityId> <RoadType>Street</RoadType> </Detail> <Exit/> <TollZone/> <TransitTerminus/> <IconType>Walk</IconType> <Time>0001-01-01T00:00:00</Time> <TransitStopId>0</TransitStopId> <SideOfStreet>Unknown</SideOfStreet> </ItineraryItem> <ItineraryItem> <TravelMode>Walking</TravelMode> <TravelDistance>0.102</TravelDistance> <TravelDuration>73</TravelDuration> <ManeuverPoint> <Latitude>48.859752</Latitude> <Longitude>2.329633</Longitude> </ManeuverPoint>

190

<Instruction maneuverType="TurnLeft">Turn left onto Pont Royal</Instruction> <CompassDirection>northeast</CompassDirection> <Detail> <ManeuverType>TurnLeft</ManeuverType> <StartPathIndex>25</StartPathIndex> <EndPathIndex>27</EndPathIndex> <Name>Pont Royal</Name> <CompassDegrees>36</CompassDegrees> <Mode>Walking</Mode> <PreviousEntityId>0</PreviousEntityId> <NextEntityId>0</NextEntityId> <RoadType>MajorRoad</RoadType> </Detail> <Exit/> <TollZone/> <TransitTerminus/> <IconType>Walk</IconType> <Time>0001-01-01T00:00:00</Time> <TransitStopId>0</TransitStopId> <SideOfStreet>Unknown</SideOfStreet> </ItineraryItem> <ItineraryItem> <TravelMode>Walking</TravelMode> <TravelDistance>0.038</TravelDistance> <TravelDuration>27</TravelDuration> <ManeuverPoint> <Latitude>48.860562</Latitude> <Longitude>2.330228</Longitude> </ManeuverPoint> <Instruction maneuverType="KeepToStayRight">Keep right to stay on Pont Royal</Instruction> <CompassDirection>east</CompassDirection> <Detail> 191

<ManeuverType>KeepToStayRight</ManeuverType> <StartPathIndex>27</StartPathIndex> <EndPathIndex>30</EndPathIndex> <Name>Pont Royal</Name> <CompassDegrees>73</CompassDegrees> <Mode>Walking</Mode> <PreviousEntityId>0</PreviousEntityId> <NextEntityId>0</NextEntityId> <RoadType>MajorRoad</RoadType> </Detail> <Exit/> <TollZone/> <TransitTerminus/> <IconType>Walk</IconType> <Time>0001-01-01T00:00:00</Time> <TransitStopId>0</TransitStopId> <SideOfStreet>Unknown</SideOfStreet> </ItineraryItem> <ItineraryItem> <TravelMode>Walking</TravelMode> <TravelDistance>0.703</TravelDistance> <TravelDuration>506</TravelDuration> <ManeuverPoint> <Latitude>48.860691</Latitude> <Longitude>2.3307</Longitude> </ManeuverPoint> <Instruction maneuverType="BearRight">Bear right onto Quai Franois Mitterrand</Instruction> <CompassDirection>east</CompassDirection> <Detail> <ManeuverType>BearRight</ManeuverType> <StartPathIndex>30</StartPathIndex> <EndPathIndex>33</EndPathIndex> <Name>Quai Franois Mitterrand</Name> 192

<CompassDegrees>103</CompassDegrees> <Mode>Walking</Mode> <PreviousEntityId>0</PreviousEntityId> <NextEntityId>0</NextEntityId> <RoadType>MajorRoad</RoadType> </Detail> <Exit/> <TollZone/> <TransitTerminus/> <IconType>Walk</IconType> <Time>0001-01-01T00:00:00</Time> <TransitStopId>0</TransitStopId> <SideOfStreet>Unknown</SideOfStreet> </ItineraryItem> <ItineraryItem> <TravelMode>Walking</TravelMode> <TravelDistance>0.132</TravelDistance> <TravelDuration>95</TravelDuration> <ManeuverPoint> <Latitude>48.859012</Latitude> <Longitude>2.339852</Longitude> </ManeuverPoint> <Instruction maneuverType="TurnLeft">Turn left onto Rue de l'Amiral de Coligny</Instruction> <CompassDirection>northeast</CompassDirection> <Detail> <ManeuverType>TurnLeft</ManeuverType> <StartPathIndex>33</StartPathIndex> <EndPathIndex>36</EndPathIndex> <Name>Rue de l'Amiral de Coligny</Name> <CompassDegrees>29</CompassDegrees> <Mode>Walking</Mode> <PreviousEntityId>0</PreviousEntityId> <NextEntityId>0</NextEntityId> 193

<RoadType>Arterial</RoadType> </Detail> <Exit/> <TollZone/> <TransitTerminus/> <IconType>Walk</IconType> <Time>0001-01-01T00:00:00</Time> <TransitStopId>0</TransitStopId> <SideOfStreet>Unknown</SideOfStreet> </ItineraryItem> <ItineraryItem> <TravelMode>Walking</TravelMode> <TravelDistance>0</TravelDistance> <TravelDuration>0</TravelDuration> <ManeuverPoint> <Latitude>48.860118</Latitude> <Longitude>2.340455</Longitude> </ManeuverPoint> <Instruction maneuverType="ArriveFinish">Arrive at Louvre, Paris, France</Instruction> <CompassDirection>northeast</CompassDirection> <Hint> The last intersection is Place du Louvre / Rue des Prtres Saint-Germainl'Auxerrois </Hint> <Hint>If you reach Place du Louvre, you've gone too far</Hint> <Detail> <ManeuverType>ArriveFinish</ManeuverType> <StartPathIndex>36</StartPathIndex> <EndPathIndex>36</EndPathIndex> <Name>Rue de l'Amiral de Coligny</Name> <CompassDegrees>26</CompassDegrees> <Mode>Walking</Mode> <PreviousEntityId>0</PreviousEntityId> 194

<NextEntityId>0</NextEntityId> <RoadType>Arterial</RoadType> </Detail> <Exit/> <TollZone/> <TransitTerminus/> <IconType>Walk</IconType> <Time>0001-01-01T00:00:00</Time> <TransitStopId>0</TransitStopId> <SideOfStreet>Unknown</SideOfStreet> </ItineraryItem> <StartTime>0001-01-01T00:00:00</StartTime> <EndTime>0001-01-01T00:00:00</EndTime> </RouteLeg> </Route> </Resources> </ResourceSet> </ResourceSets> </Response>

JSON Response You would receive the following JSON response if the output=xml parameter was not set in this example.
{ "authenticationResultCode":"ValidCredentials", "brandLogoUri":"http:\/\/dev.virtualearth.net\/Branding\/logo_powered_by.png", "copyright":"Copyright 2011 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.", "resourceSets":[ { "estimatedTotal":1, "resources":[ { 195

"__type":"Route:http:\/\/schemas.microsoft.com\/search\/local\/ws\/rest\/v1", "bbox":[ 48.857371, 2.295273, 48.860788, 2.340455 ], "id":"v62,i0,a0,cenUS,dAAAAAAAAAAA=,y0,s1,m2,o2,t0,wEcpXBNw6NAA=~oHj1SFPg4RQAAOABsjz3PgA=~RWlmZmVsIFRvd2VyLC BQYXJpcywgRnJhbmNl~~~,w49ZXBP5BNQA=~oHj1SDG\/4RQAAOAB0m39PgA=~TG91dnJlLCBQYXJpcywgRnJhbmN l~~~,k1,u", "distanceUnit":"Kilometer", "durationUnit":"Second", "routeLegs":[ { "actualEnd":{ "type":"Point", "coordinates":[ 48.860118, 2.340455 ] }, "actualStart":{ "type":"Point", "coordinates":[ 48.85791, 2.295273 ] }, "endLocation":{ "bbox":[ 48.859371, 2.33046,

196

48.863522, 2.33995 ], "name":"Louvre, Paris, France", "point":{ "type":"Point", "coordinates":[ 48.86013, 2.34043 ] }, "address":{ "adminDistrict":"IdF", "adminDistrict2":"Paris", "countryRegion":"France", "formattedAddress":"Louvre, Paris, France", "locality":"Paris", "landmark":"Louvre" }, "confidence":"High", "entityType":"Museum", "geocodePoints":[ { "type":"Point", "coordinates":[ 48.86013, 2.34043 ], "calculationMethod":"Rooftop", "usageTypes":[ "Display" ] } ], 197

"matchCodes":[ "Good" ] }, "itineraryItems":[ { "compassDirection":"northeast", "details":[ { "compassDegrees":56, "endPathIndices":[ 1 ], "maneuverType":"DepartStart", "mode":"Walking", "names":[ "Avenue Gustave Eiffel" ], "roadType":"Street", "startPathIndices":[ 0 ] } ], "exit":"", "iconType":"Walk", "instruction":{ "maneuverType":"DepartStart", "text":"Depart Avenue Gustave Eiffel toward Avenue Anatole France" }, "maneuverPoint":{ "type":"Point", "coordinates":[ 198

48.85791, 2.295273 ] }, "sideOfStreet":"Unknown", "tollZone":"", "towardsRoadName":"Avenue Anatole France", "transitTerminus":"", "travelDistance":0.01, "travelDuration":7, "travelMode":"Walking" }, { "compassDirection":"east", "details":[ { "compassDegrees":79, "endPathIndices":[ 4 ], "maneuverType":"KeepStraight", "mode":"Walking", "roadType":"Street", "startPathIndices":[ 1 ] } ], "exit":"", "iconType":"Walk", "instruction":{ "maneuverType":"KeepStraight", "text":"Keep straight onto path" }, 199

"maneuverPoint":{ "type":"Point", "coordinates":[ 48.857982, 2.295381 ] }, "sideOfStreet":"Unknown", "tollZone":"", "transitTerminus":"", "travelDistance":0.134, "travelDuration":96, "travelMode":"Walking" }, { "compassDirection":"southeast", "details":[ { "compassDegrees":80, "endPathIndices":[ 7 ], "maneuverType":"TurnLeft", "mode":"Walking", "roadType":"Street", "startPathIndices":[ 4 ] }, { "compassDegrees":123, "endPathIndices":[ 9 ], 200

"maneuverType":"BearRight", "mode":"Walking", "names":[ "Alle Adrienne Lecouvreur" ], "roadType":"Street", "startPathIndices":[ 7 ] } ], "exit":"", "iconType":"Walk", "instruction":{ "maneuverType":"TurnLeftThenBearRight", "text":"Turn left and then bear right onto Alle Adrienne Lecouvreur" }, "maneuverPoint":{ "type":"Point", "coordinates":[ 48.857773, 2.297081 ] }, "sideOfStreet":"Unknown", "tollZone":"", "transitTerminus":"", "travelDistance":0.112, "travelDuration":80, "travelMode":"Walking" }, { "compassDirection":"east", 201

"details":[ { "compassDegrees":79, "endPathIndices":[ 12 ], "maneuverType":"BearLeft", "mode":"Walking", "names":[ "Avenue mile Pouvillon" ], "roadType":"Street", "startPathIndices":[ 9 ] } ], "exit":"", "iconType":"Walk", "instruction":{ "maneuverType":"BearLeft", "text":"Bear left onto Avenue mile Pouvillon" }, "maneuverPoint":{ "type":"Point", "coordinates":[ 48.857371, 2.298181 ] }, "sideOfStreet":"Unknown", "tollZone":"", "transitTerminus":"", "travelDistance":0.15, 202

"travelDuration":108, "travelMode":"Walking" }, { "compassDirection":"east", "details":[ { "compassDegrees":69, "endPathIndices":[ 21 ], "maneuverType":"RoadNameChange", "mode":"Walking", "names":[ "Rue Saint-Dominique" ], "roadType":"Street", "startPathIndices":[ 12 ] } ], "exit":"", "iconType":"Walk", "instruction":{ "maneuverType":"RoadNameChange", "text":"Road name changes to Rue Saint-Dominique" }, "maneuverPoint":{ "type":"Point", "coordinates":[ 48.85765, 2.300139 ] 203

}, "sideOfStreet":"Unknown", "tollZone":"", "transitTerminus":"", "travelDistance":1.77, "travelDuration":1274, "travelMode":"Walking" }, { "compassDirection":"northeast", "details":[ { "compassDegrees":45, "endPathIndices":[ 25 ], "maneuverType":"TurnLeft", "mode":"Walking", "names":[ "Rue de Bellechasse" ], "roadType":"Street", "startPathIndices":[ 21 ] } ], "exit":"", "iconType":"Walk", "instruction":{ "maneuverType":"TurnLeft", "text":"Turn left onto Rue de Bellechasse" }, "maneuverPoint":{ 204

"type":"Point", "coordinates":[ 48.858159, 2.322793 ] }, "sideOfStreet":"Unknown", "tollZone":"", "transitTerminus":"", "travelDistance":0.703, "travelDuration":506, "travelMode":"Walking" }, { "compassDirection":"northeast", "details":[ { "compassDegrees":36, "endPathIndices":[ 27 ], "maneuverType":"TurnLeft", "mode":"Walking", "names":[ "Pont Royal" ], "roadType":"MajorRoad", "startPathIndices":[ 25 ] } ], "exit":"", "iconType":"Walk", 205

"instruction":{ "maneuverType":"TurnLeft", "text":"Turn left onto Pont Royal" }, "maneuverPoint":{ "type":"Point", "coordinates":[ 48.859752, 2.329633 ] }, "sideOfStreet":"Unknown", "tollZone":"", "transitTerminus":"", "travelDistance":0.102, "travelDuration":73, "travelMode":"Walking" }, { "compassDirection":"east", "details":[ { "compassDegrees":73, "endPathIndices":[ 30 ], "maneuverType":"KeepToStayRight", "mode":"Walking", "names":[ "Pont Royal" ], "roadType":"MajorRoad", "startPathIndices":[ 27 206

] } ], "exit":"", "iconType":"Walk", "instruction":{ "maneuverType":"KeepToStayRight", "text":"Keep right to stay on Pont Royal" }, "maneuverPoint":{ "type":"Point", "coordinates":[ 48.860562, 2.330228 ] }, "sideOfStreet":"Unknown", "tollZone":"", "transitTerminus":"", "travelDistance":0.038, "travelDuration":27, "travelMode":"Walking" }, { "compassDirection":"east", "details":[ { "compassDegrees":103, "endPathIndices":[ 33 ], "maneuverType":"BearRight", "mode":"Walking", "names":[ 207

"Quai Franois Mitterrand" ], "roadType":"MajorRoad", "startPathIndices":[ 30 ] } ], "exit":"", "iconType":"Walk", "instruction":{ "maneuverType":"BearRight", "text":"Bear right onto Quai Franois Mitterrand" }, "maneuverPoint":{ "type":"Point", "coordinates":[ 48.860691, 2.3307 ] }, "sideOfStreet":"Unknown", "tollZone":"", "transitTerminus":"", "travelDistance":0.703, "travelDuration":506, "travelMode":"Walking" }, { "compassDirection":"northeast", "details":[ { "compassDegrees":29, "endPathIndices":[ 208

36 ], "maneuverType":"TurnLeft", "mode":"Walking", "names":[ "Rue de l'Amiral de Coligny" ], "roadType":"Arterial", "startPathIndices":[ 33 ] } ], "exit":"", "iconType":"Walk", "instruction":{ "maneuverType":"TurnLeft", "text":"Turn left onto Rue de l'Amiral de Coligny" }, "maneuverPoint":{ "type":"Point", "coordinates":[ 48.859012, 2.339852 ] }, "sideOfStreet":"Unknown", "tollZone":"", "transitTerminus":"", "travelDistance":0.132, "travelDuration":95, "travelMode":"Walking" }, { 209

"compassDirection":"northeast", "details":[ { "compassDegrees":26, "endPathIndices":[ 36 ], "maneuverType":"ArriveFinish", "mode":"Walking", "names":[ "Rue de l'Amiral de Coligny" ], "roadType":"Arterial", "startPathIndices":[ 36 ] } ], "exit":"", "hints":[ { "hintType":null, "text":"The last intersection is Place du Louvre \/ Rue des Prtres Saint-Germain-l'Auxerrois" }, { "hintType":null, "text":"If you reach Place du Louvre, you've gone too far" } ], "iconType":"Walk", "instruction":{ "maneuverType":"ArriveFinish", 210

"text":"Arrive at Louvre, Paris, France" }, "maneuverPoint":{ "type":"Point", "coordinates":[ 48.860118, 2.340455 ] }, "sideOfStreet":"Unknown", "tollZone":"", "transitTerminus":"", "travelDistance":0, "travelDuration":0, "travelMode":"Walking" } ], "startLocation":{ "bbox":[ 48.85746, 2.2933, 48.859039, 2.29569 ], "name":"Eiffel Tower, Paris, France", "point":{ "type":"Point", "coordinates":[ 48.857929, 2.29526 ] }, "address":{ "adminDistrict":"IdF", 211

"adminDistrict2":"Paris", "countryRegion":"France", "formattedAddress":"Eiffel Tower, Paris, France", "locality":"Paris", "landmark":"Eiffel Tower" }, "confidence":"High", "entityType":"Monument", "geocodePoints":[ { "type":"Point", "coordinates":[ 48.857929, 2.29526 ], "calculationMethod":"Rooftop", "usageTypes":[ "Display" ] } ], "matchCodes":[ "Good" ] }, "travelDistance":3.854, "travelDuration":2775 } ], "travelDistance":3.854, "travelDuration":2775 } ] } 212

], "statusCode":200, "statusDescription":"OK", "traceId":"10fc9a17384d4d1096be9e428af7d32a" }

Transit Route Example


The following example shows how to request a transit route between the Golden Gate Bridge and Fishermans Wharf in San Francisco for 3 PM on the current day. Responses are shown for both XML and JSON formats.
http://dev.virtualearth.net/REST/V1/Routes/Transit?wp.0=Golden%20Gate%20Bridge&wp.1=Fishe rmans%20Wharf&timeType=Departure&dateTime=3:00:00PM&output=xml&key=BingMapsKey

XML Response The response for this example contains a Route resource that provides walking instructions and transit information for the route.
<Response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/search/local/ws/rest/v1"> <Copyright> Copyright 2011 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation. </Copyright> <BrandLogoUri> http://dev.virtualearth.net/Branding/logo_powered_by.png </BrandLogoUri> <StatusCode>200</StatusCode> <StatusDescription>OK</StatusDescription> <AuthenticationResultCode>ValidCredentials</AuthenticationResultCode> <TraceId> 5449c40063b0462596698e263e235aa7 </TraceId> <ResourceSets> <ResourceSet> <EstimatedTotal>1</EstimatedTotal> <Resources> 213

<Route> <Id> v62,i0,a0,cenUS,dANjBD75mzgg=,y1,s1,m4,o1,t0,wjpNcA4TvHPU=~rrD3jQAAAAAAAAAAAAAAAAA=~R29sZGVuIEdhdGUgQn JpZGdlLCBDQQ==~~~,wHE9cA+mTHvU=~rrD3jQAAAAAAAAAAAAAAAAA=~RmlzaGVybWFuJ3MgV2hhcmYsIENB~~~, k1,u </Id> <BoundingBox> <SouthLatitude>37.798793</SouthLatitude> <WestLongitude>-122.478416</WestLongitude> <NorthLatitude>37.818312</NorthLatitude> <EastLongitude>-122.40625</EastLongitude> </BoundingBox> <DistanceUnit>Kilometer</DistanceUnit> <DurationUnit>Second</DurationUnit> <TravelDistance>2.363</TravelDistance> <TravelDuration>3416</TravelDuration> <RouteLeg> <TravelDistance>2.363</TravelDistance> <TravelDuration>3416</TravelDuration> <ActualStart> <Latitude>37.807561</Latitude> <Longitude>-122.475024</Longitude> </ActualStart> <ActualEnd> <Latitude>37.80551</Latitude> <Longitude>-122.41784</Longitude> </ActualEnd> <StartLocation> <Name>Golden Gate Bridge, CA</Name> <Point> <Latitude>37.818298</Latitude> <Longitude>-122.478416</Longitude> </Point>

214

<BoundingBox> <SouthLatitude>37.789328</SouthLatitude> <WestLongitude>-122.527295</WestLongitude> <NorthLatitude>37.847269</NorthLatitude> <EastLongitude>-122.429538</EastLongitude> </BoundingBox> <EntityType>Bridge</EntityType> <Address> <AdminDistrict>CA</AdminDistrict> <CountryRegion>United States</CountryRegion> <FormattedAddress>Golden Gate Bridge, CA</FormattedAddress> <Landmark>Golden Gate Bridge</Landmark> </Address> <Confidence>High</Confidence> <MatchCode>Good</MatchCode> <GeocodePoint> <Latitude>37.818298</Latitude> <Longitude>-122.478416</Longitude> <CalculationMethod>Rooftop</CalculationMethod> <UsageType>Display</UsageType> </GeocodePoint> </StartLocation> <EndLocation> <Name>Fisherman's Wharf, CA</Name> <Point> <Latitude>37.806549</Latitude> <Longitude>-122.40625</Longitude> </Point> <BoundingBox> <SouthLatitude>37.777579</SouthLatitude> <WestLongitude>-122.455121</WestLongitude> <NorthLatitude>37.835519</NorthLatitude> <EastLongitude>-122.357379</EastLongitude> </BoundingBox> 215

<EntityType>PopulatedPlace</EntityType> <Address> <AdminDistrict>CA</AdminDistrict> <AdminDistrict2>San Francisco Co.</AdminDistrict2> <CountryRegion>United States</CountryRegion> <FormattedAddress>Fisherman's Wharf, CA</FormattedAddress> <Locality>Fisherman's Wharf</Locality> </Address> <Confidence>High</Confidence> <MatchCode>Good</MatchCode> <GeocodePoint> <Latitude>37.806549</Latitude> <Longitude>-122.40625</Longitude> <CalculationMethod>Rooftop</CalculationMethod> <UsageType>Display</UsageType> </GeocodePoint> </EndLocation> <ItineraryItem> <TravelMode>Transit</TravelMode> <TravelDistance>1.307</TravelDistance> <TravelDuration>941</TravelDuration> <ManeuverPoint> <Latitude>37.818298</Latitude> <Longitude>-122.478416</Longitude> </ManeuverPoint> <Instruction maneuverType="DepartStart"> Walk: From Golden Gate Bridge, CA to Golden Gate Bridge/Parking Lot </Instruction> <CompassDirection/> <Detail> <ManeuverType>Walk</ManeuverType> <StartPathIndex>0</StartPathIndex> <EndPathIndex>8</EndPathIndex> <CompassDegrees>0</CompassDegrees> 216

<Mode>Transit</Mode> <PreviousEntityId>0</PreviousEntityId> <NextEntityId>0</NextEntityId> <RoadType>NotApplicable</RoadType> </Detail> <Exit/> <TollZone/> <TransitTerminus/> <IconType>Walk</IconType> <Time>0001-01-01T00:00:00</Time> <TransitStopId>0</TransitStopId> <SideOfStreet>Unknown</SideOfStreet> </ItineraryItem> <ItineraryItem> <TravelMode>Transit</TravelMode> <TravelDistance>0</TravelDistance> <TravelDuration>711</TravelDuration> <ManeuverPoint> <Latitude>37.807561</Latitude> <Longitude>-122.475024</Longitude> </ManeuverPoint> <Instruction maneuverType="TakeTransit">Bus: Take 28 - Fort Mason</Instruction> <CompassDirection/> <Hint>Previous stop is Lombard St & Fillmore St</Hint> <Hint> If you reach Buchanan St & Bay St, you've gone too far </Hint> <Detail> <ManeuverType>TakeTransit</ManeuverType> <StartPathIndex>8</StartPathIndex> <EndPathIndex>35</EndPathIndex> <CompassDegrees>0</CompassDegrees> <Mode>Transit</Mode> 217

<PreviousEntityId>0</PreviousEntityId> <NextEntityId>0</NextEntityId> <RoadType>NotApplicable</RoadType> </Detail> <ChildItineraryItems> <ItineraryItem> <TravelMode>Driving</TravelMode> <TravelDistance>0</TravelDistance> <TravelDuration>0</TravelDuration> <ManeuverPoint> <Latitude>0</Latitude> <Longitude>0</Longitude> </ManeuverPoint> <Instruction maneuverType="TransitDepart">Depart: Golden Gate Bridge/Parking Lot</Instruction> <CompassDirection/> <Detail> <ManeuverType>TransitDepart</ManeuverType> <Name>Golden Gate Bridge/Parking Lot</Name> <CompassDegrees>0</CompassDegrees> <Mode>Driving</Mode> <PreviousEntityId>0</PreviousEntityId> <NextEntityId>0</NextEntityId> <RoadType>None</RoadType> </Detail> <Exit/> <TollZone/> <TransitTerminus/> <IconType>None</IconType> <Time>2011-11-01T15:17:43</Time> <TransitStopId>100966</TransitStopId> <SideOfStreet>Unknown</SideOfStreet> </ItineraryItem> <ItineraryItem> 218

<TravelMode>Driving</TravelMode> <TravelDistance>0</TravelDistance> <TravelDuration>0</TravelDuration> <ManeuverPoint> <Latitude>0</Latitude> <Longitude>0</Longitude> </ManeuverPoint> <Instruction maneuverType="TransitArrive">Arrive: Laguna St & Chestnut St</Instruction> <CompassDirection/> <Detail> <ManeuverType>TransitArrive</ManeuverType> <Name>Laguna St & Chestnut St</Name> <CompassDegrees>0</CompassDegrees> <Mode>Driving</Mode> <PreviousEntityId>0</PreviousEntityId> <NextEntityId>0</NextEntityId> <RoadType>None</RoadType> </Detail> <Exit/> <TollZone/> <TransitTerminus/> <IconType>None</IconType> <Time>2011-11-01T15:29:34</Time> <TransitStopId>101446</TransitStopId> <SideOfStreet>Unknown</SideOfStreet> </ItineraryItem> </ChildItineraryItems> <Exit/> <TollZone/> <TransitTerminus>Fort Mason</TransitTerminus> <IconType>Bus</IconType> <Time>0001-01-01T00:00:00</Time> <TransitStopId>0</TransitStopId> 219

<TransitLine> <VerboseName>19TH AVENUE</VerboseName> <AbbreviatedName>28</AbbreviatedName> <AgencyId>30</AgencyId> <AgencyName>San Francisco Municipal Transportation Agency</AgencyName> <LineColor>16777215</LineColor> <LineTextColor>16777215</LineTextColor> <Uri>http://www.sfmta.com</Uri> <PhoneNumber/> <ProviderInfo> Service Provider: San Francisco Municipal Transportation Agency </ProviderInfo> </TransitLine> <SideOfStreet>Unknown</SideOfStreet> </ItineraryItem> <ItineraryItem> <TravelMode>Transit</TravelMode> <TravelDistance>0.011</TravelDistance> <TravelDuration>60</TravelDuration> <ManeuverPoint> <Latitude>37.80135</Latitude> <Longitude>-122.43123</Longitude> </ManeuverPoint> <Instruction maneuverType="Walk"> Walk: From Laguna St & Chestnut St to Chestnut St & Laguna St </Instruction> <CompassDirection/> <Hint>8 minutes to make the connection</Hint> <Detail> <ManeuverType>Walk</ManeuverType> <StartPathIndex>35</StartPathIndex> <EndPathIndex>38</EndPathIndex> <CompassDegrees>0</CompassDegrees> <Mode>Transit</Mode> 220

<PreviousEntityId>0</PreviousEntityId> <NextEntityId>0</NextEntityId> <RoadType>NotApplicable</RoadType> </Detail> <Exit/> <TollZone/> <TransitTerminus/> <IconType>Walk</IconType> <Time>0001-01-01T00:00:00</Time> <TransitStopId>0</TransitStopId> <SideOfStreet>Unknown</SideOfStreet> </ItineraryItem> <ItineraryItem> <TravelMode>Transit</TravelMode> <TravelDistance>0</TravelDistance> <TravelDuration>532</TravelDuration> <ManeuverPoint> <Latitude>37.80137</Latitude> <Longitude>-122.431406</Longitude> </ManeuverPoint> <Instruction maneuverType="TakeTransit">Bus: Take 30 - Townsend & 4 th St.</Instruction> <CompassDirection/> <Hint>Previous stop is North Point St & Hyde St</Hint> <Hint> If you reach Columbus Ave & Francisco St, you've gone too far </Hint> <Detail> <ManeuverType>TakeTransit</ManeuverType> <StartPathIndex>38</StartPathIndex> <EndPathIndex>46</EndPathIndex> <CompassDegrees>0</CompassDegrees> <Mode>Transit</Mode> <PreviousEntityId>0</PreviousEntityId> 221

<NextEntityId>0</NextEntityId> <RoadType>NotApplicable</RoadType> </Detail> <ChildItineraryItems> <ItineraryItem> <TravelMode>Driving</TravelMode> <TravelDistance>0</TravelDistance> <TravelDuration>0</TravelDuration> <ManeuverPoint> <Latitude>0</Latitude> <Longitude>0</Longitude> </ManeuverPoint> <Instruction maneuverType="TransitDepart">Depart: Chestnut St & Laguna St</Instruction> <CompassDirection/> <Detail> <ManeuverType>TransitDepart</ManeuverType> <Name>Chestnut St & Laguna St</Name> <CompassDegrees>0</CompassDegrees> <Mode>Driving</Mode> <PreviousEntityId>0</PreviousEntityId> <NextEntityId>0</NextEntityId> <RoadType>None</RoadType> </Detail> <Exit/> <TollZone/> <TransitTerminus/> <IconType>None</IconType> <Time>2011-11-01T15:37:34</Time> <TransitStopId>100197</TransitStopId> <SideOfStreet>Unknown</SideOfStreet> </ItineraryItem> <ItineraryItem> <TravelMode>Driving</TravelMode> 222

<TravelDistance>0</TravelDistance> <TravelDuration>0</TravelDuration> <ManeuverPoint> <Latitude>0</Latitude> <Longitude>0</Longitude> </ManeuverPoint> <Instruction maneuverType="TransitArrive">Arrive: Columbus Ave & Bay St</Instruction> <CompassDirection/> <Detail> <ManeuverType>TransitArrive</ManeuverType> <Name>Columbus Ave & Bay St</Name> <CompassDegrees>0</CompassDegrees> <Mode>Driving</Mode> <PreviousEntityId>0</PreviousEntityId> <NextEntityId>0</NextEntityId> <RoadType>None</RoadType> </Detail> <Exit/> <TollZone/> <TransitTerminus/> <IconType>None</IconType> <Time>2011-11-01T15:46:26</Time> <TransitStopId>100337</TransitStopId> <SideOfStreet>Unknown</SideOfStreet> </ItineraryItem> </ChildItineraryItems> <Exit/> <TollZone/> <TransitTerminus>Townsend & 4 th St.</TransitTerminus> <IconType>Bus</IconType> <Time>0001-01-01T00:00:00</Time> <TransitStopId>0</TransitStopId> <TransitLine> 223

<VerboseName>STOCKTON</VerboseName> <AbbreviatedName>30</AbbreviatedName> <AgencyId>30</AgencyId> <AgencyName>San Francisco Municipal Transportation Agency</AgencyName> <LineColor>16777215</LineColor> <LineTextColor>16777215</LineTextColor> <Uri>http://www.sfmta.com</Uri> <PhoneNumber/> <ProviderInfo> Service Provider: San Francisco Municipal Transportation Agency </ProviderInfo> </TransitLine> <SideOfStreet>Unknown</SideOfStreet> </ItineraryItem> <ItineraryItem> <TravelMode>Transit</TravelMode> <TravelDistance>1.045</TravelDistance> <TravelDuration>752</TravelDuration> <ManeuverPoint> <Latitude>37.80551</Latitude> <Longitude>-122.41784</Longitude> </ManeuverPoint> <Instruction maneuverType="ArriveFinish"> Walk: From Columbus Ave & Bay St to Fisherman's Wharf, CA </Instruction> <CompassDirection/> <Detail> <ManeuverType>Walk</ManeuverType> <StartPathIndex>46</StartPathIndex> <EndPathIndex>50</EndPathIndex> <CompassDegrees>0</CompassDegrees> <Mode>Transit</Mode> <PreviousEntityId>0</PreviousEntityId> <NextEntityId>0</NextEntityId> 224

<RoadType>NotApplicable</RoadType> </Detail> <Exit/> <TollZone/> <TransitTerminus/> <IconType>Walk</IconType> <Time>0001-01-01T00:00:00</Time> <TransitStopId>0</TransitStopId> <SideOfStreet>Unknown</SideOfStreet> </ItineraryItem> <StartTime>2011-11-01T15:02:02</StartTime> <EndTime>2011-11-01T15:58:58</EndTime> </RouteLeg> </Route> </Resources> </ResourceSet> </ResourceSets> </Response>

JSON Response You would receive the following JSON response if the output=xml parameter was not set in this example.
{ "authenticationResultCode":"ValidCredentials", "brandLogoUri":"http:\/\/dev.virtualearth.net\/Branding\/logo_powered_by.png", "copyright":"Copyright 2011 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.", "resourceSets":[ { "estimatedTotal":1, "resources":[ {

225

"__type":"Route:http:\/\/schemas.microsoft.com\/search\/local\/ws\/rest\/v1", "bbox":[ 37.798793, -122.478416, 37.818312, -122.40625 ], "id":"v62,i0,a0,cenUS,dANjBD75mzgg=,y1,s1,m4,o1,t0,wjpNcA4TvHPU=~rrD3jQAAAAAAAAAAAAAAAAA=~R29sZGVuIEdhdGUgQn JpZGdlLCBDQQ==~~~,wHE9cA+mTHvU=~rrD3jQAAAAAAAAAAAAAAAAA=~RmlzaGVybWFuJ3MgV2hhcmYsIENB~~~, k1,u", "distanceUnit":"Kilometer", "durationUnit":"Second", "routeLegs":[ { "actualEnd":{ "type":"Point", "coordinates":[ 37.80551, -122.41784 ] }, "actualStart":{ "type":"Point", "coordinates":[ 37.807561, -122.475024 ] }, "endLocation":{ "bbox":[ 37.777579, -122.455121,

226

37.835519, -122.357379 ], "name":"Fisherman's Wharf, CA", "point":{ "type":"Point", "coordinates":[ 37.806549, -122.40625 ] }, "address":{ "adminDistrict":"CA", "adminDistrict2":"San Francisco Co.", "countryRegion":"United States", "formattedAddress":"Fisherman's Wharf, CA", "locality":"Fisherman's Wharf" }, "confidence":"High", "entityType":"PopulatedPlace", "geocodePoints":[ { "type":"Point", "coordinates":[ 37.806549, -122.40625 ], "calculationMethod":"Rooftop", "usageTypes":[ "Display" ] } ], "matchCodes":[ 227

"Good" ] }, "endTime":"\/Date(1320188338000-0700)\/", "itineraryItems":[ { "compassDirection":"", "details":[ { "endPathIndices":[ 8 ], "maneuverType":"Walk", "mode":"Transit", "roadType":"NotApplicable", "startPathIndices":[ 0 ] } ], "exit":"", "iconType":"Walk", "instruction":{ "maneuverType":"DepartStart", "text":"Walk: From Golden Gate Bridge, CA to Golden Gate Bridge\/Parking Lot" }, "maneuverPoint":{ "type":"Point", "coordinates":[ 37.818298, -122.478416 ] }, 228

"sideOfStreet":"Unknown", "tollZone":"", "transitTerminus":"", "travelDistance":1.307, "travelDuration":941, "travelMode":"Transit" }, { "childItineraryItems":[ { "compassDirection":"", "details":[ { "maneuverType":"TransitDepart", "mode":"Driving", "names":[ "Golden Gate Bridge\/Parking Lot" ], "roadType":"None" } ], "exit":"", "iconType":"None", "instruction":{ "maneuverType":"TransitDepart", "text":"Depart: Golden Gate Bridge\/Parking Lot" }, "maneuverPoint":{ "type":"Point", "coordinates":[ 0, 0 ] }, 229

"sideOfStreet":"Unknown", "time":"\/Date(1320185863000-0700)\/", "tollZone":"", "transitStopId":100966, "transitTerminus":"", "travelDistance":0, "travelDuration":0, "travelMode":"Driving" }, { "compassDirection":"", "details":[ { "maneuverType":"TransitArrive", "mode":"Driving", "names":[ "Laguna St & Chestnut St" ], "roadType":"None" } ], "exit":"", "iconType":"None", "instruction":{ "maneuverType":"TransitArrive", "text":"Arrive: Laguna St & Chestnut St" }, "maneuverPoint":{ "type":"Point", "coordinates":[ 0, 0 ] }, 230

"sideOfStreet":"Unknown", "time":"\/Date(1320186574000-0700)\/", "tollZone":"", "transitStopId":101446, "transitTerminus":"", "travelDistance":0, "travelDuration":0, "travelMode":"Driving" } ], "compassDirection":"", "details":[ { "endPathIndices":[ 35 ], "maneuverType":"TakeTransit", "mode":"Transit", "roadType":"NotApplicable", "startPathIndices":[ 8 ] } ], "exit":"", "hints":[ { "hintType":null, "text":"Previous stop is Lombard St & Fillmore St" }, { "hintType":null, "text":"If you reach Buchanan St & Bay St, you've gone too far" 231

} ], "iconType":"Bus", "instruction":{ "maneuverType":"TakeTransit", "text":"Bus: Take 28 - Fort Mason" }, "maneuverPoint":{ "type":"Point", "coordinates":[ 37.807561, -122.475024 ] }, "sideOfStreet":"Unknown", "tollZone":"", "transitLine":{ "abbreviatedName":"28", "agencyId":30, "agencyName":"San Francisco Municipal Transportation Agency", "lineColor":16777215, "lineTextColor":16777215, "phoneNumber":"", "providerInfo":"Service Provider: San Francisco Municipal Transportation Agency ", "uri":"http:\/\/www.sfmta.com", "verboseName":"19TH AVENUE" }, "transitTerminus":"Fort Mason", "travelDistance":0, "travelDuration":711, "travelMode":"Transit" }, 232

{ "compassDirection":"", "details":[ { "endPathIndices":[ 38 ], "maneuverType":"Walk", "mode":"Transit", "roadType":"NotApplicable", "startPathIndices":[ 35 ] } ], "exit":"", "hints":[ { "hintType":null, "text":"8 minutes to make the connection" } ], "iconType":"Walk", "instruction":{ "maneuverType":"Walk", "text":"Walk: From Laguna St & Chestnut St to Chestnut St & Laguna St" }, "maneuverPoint":{ "type":"Point", "coordinates":[ 37.80135, -122.43123 ] 233

}, "sideOfStreet":"Unknown", "tollZone":"", "transitTerminus":"", "travelDistance":0.011, "travelDuration":60, "travelMode":"Transit" }, { "childItineraryItems":[ { "compassDirection":"", "details":[ { "maneuverType":"TransitDepart", "mode":"Driving", "names":[ "Chestnut St & Laguna St" ], "roadType":"None" } ], "exit":"", "iconType":"None", "instruction":{ "maneuverType":"TransitDepart", "text":"Depart: Chestnut St & Laguna St" }, "maneuverPoint":{ "type":"Point", "coordinates":[ 0, 0 ] 234

}, "sideOfStreet":"Unknown", "time":"\/Date(1320187054000-0700)\/", "tollZone":"", "transitStopId":100197, "transitTerminus":"", "travelDistance":0, "travelDuration":0, "travelMode":"Driving" }, { "compassDirection":"", "details":[ { "maneuverType":"TransitArrive", "mode":"Driving", "names":[ "Columbus Ave & Bay St" ], "roadType":"None" } ], "exit":"", "iconType":"None", "instruction":{ "maneuverType":"TransitArrive", "text":"Arrive: Columbus Ave & Bay St" }, "maneuverPoint":{ "type":"Point", "coordinates":[ 0, 0 ] 235

}, "sideOfStreet":"Unknown", "time":"\/Date(1320187586000-0700)\/", "tollZone":"", "transitStopId":100337, "transitTerminus":"", "travelDistance":0, "travelDuration":0, "travelMode":"Driving" } ], "compassDirection":"", "details":[ { "endPathIndices":[ 46 ], "maneuverType":"TakeTransit", "mode":"Transit", "roadType":"NotApplicable", "startPathIndices":[ 38 ] } ], "exit":"", "hints":[ { "hintType":null, "text":"Previous stop is North Point St & Hyde St" }, { "hintType":null,

236

"text":"If you reach Columbus Ave & Francisco St, you've gone too far" } ], "iconType":"Bus", "instruction":{ "maneuverType":"TakeTransit", "text":"Bus: Take 30 - Townsend & 4 th St." }, "maneuverPoint":{ "type":"Point", "coordinates":[ 37.80137, -122.431406 ] }, "sideOfStreet":"Unknown", "tollZone":"", "transitLine":{ "abbreviatedName":"30", "agencyId":30, "agencyName":"San Francisco Municipal Transportation Agency", "lineColor":16777215, "lineTextColor":16777215, "phoneNumber":"", "providerInfo":"Service Provider: San Francisco Municipal Transportation Agency ", "uri":"http:\/\/www.sfmta.com", "verboseName":"STOCKTON" }, "transitTerminus":"Townsend & 4 th St.", "travelDistance":0, "travelDuration":532,

237

"travelMode":"Transit" }, { "compassDirection":"", "details":[ { "endPathIndices":[ 50 ], "maneuverType":"Walk", "mode":"Transit", "roadType":"NotApplicable", "startPathIndices":[ 46 ] } ], "exit":"", "iconType":"Walk", "instruction":{ "maneuverType":"ArriveFinish", "text":"Walk: From Columbus Ave & Bay St to Fisherman's Wharf, CA" }, "maneuverPoint":{ "type":"Point", "coordinates":[ 37.80551, -122.41784 ] }, "sideOfStreet":"Unknown", "tollZone":"", "transitTerminus":"", 238

"travelDistance":1.045, "travelDuration":752, "travelMode":"Transit" } ], "startLocation":{ "bbox":[ 37.789328, -122.527295, 37.847269, -122.429538 ], "name":"Golden Gate Bridge, CA", "point":{ "type":"Point", "coordinates":[ 37.818298, -122.478416 ] }, "address":{ "adminDistrict":"CA", "countryRegion":"United States", "formattedAddress":"Golden Gate Bridge, CA", "landmark":"Golden Gate Bridge" }, "confidence":"High", "entityType":"Bridge", "geocodePoints":[ { "type":"Point", "coordinates":[ 37.818298, -122.478416 239

], "calculationMethod":"Rooftop", "usageTypes":[ "Display" ] } ], "matchCodes":[ "Good" ] }, "startTime":"\/Date(1320184922000-0700)\/", "travelDistance":2.363, "travelDuration":3416 } ], "travelDistance":2.363, "travelDuration":3416 } ] } ], "statusCode":200, "statusDescription":"OK", "traceId":"ce523ad2a0b84f23b27176d428e29298|BR1M007702|02.00.70.2800|BR1MSNVM007519, BR1MSNVM007509, BR1MSNVM007522, BR1MSNVM007520" }

See Also Bing Maps Transit Coverage

Driving Route with Route Path Example


This example returns a driving route from the Minneapolis, Minnesota to St. Paul, Minnesota. The route is optimized for distance and requests point values for the routes path. Results are shown for both JSON and XML response formats..
240

http://dev.virtualearth.net/REST/V1/Routes/Driving?wp.0=Minneapolis,MN&wp.1=St%20Paul,MN& optmz=distance&rpo=Points&key=BingMapsKey

JSON Response The response for this example contains a Route resource with a set of ItineraryItem values that provide route steps. It also provides a set of points (latitude and longitude) that define the routes path.
{ "authenticationResultCode":"ValidCredentials", "brandLogoUri":"http:\/\/dev.virtualearth.net\/Branding\/logo_powered_by.png", "copyright":"Copyright 2011 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.", "resourceSets":[ { "estimatedTotal":1, "resources":[ {

"__type":"Route:http:\/\/schemas.microsoft.com\/search\/local\/ws\/rest\/v1", "bbox":[ 44.943738, -93.264908, 44.979942, -93.093325 ], "id":"v62,i0,a0,cenUS,dAAAAAAAAAAA=,y0,s1,m1,o2,t4,w2YX\/A2a0tfc=~XpeTlHEqBQgAAOABAAAAAAA=~TWlubmVhcG9saXMsI E1O~~~,wvLj+Axacufc=~XpeTlAElEggAAOAB1BkBPwA=~U3QgUGF1bCwgTU4=~~~,k1,u", "distanceUnit":"Kilometer", "durationUnit":"Second", "routeLegs":[ { "actualEnd":{ "type":"Point",

241

"coordinates":[ 44.943829, -93.093325 ] }, "actualStart":{ "type":"Point", "coordinates":[ 44.979063, -93.264908 ] }, "endLocation":{ "bbox":[ 44.607239, -93.884979, 45.300064, -92.301086 ], "name":"St Paul, MN", "point":{ "type":"Point", "coordinates":[ 44.943821, -93.093323 ] }, "address":{ "adminDistrict":"MN", "adminDistrict2":"Ramsey Co.", "countryRegion":"United States", "formattedAddress":"St Paul, MN", "locality":"St Paul" }, 242

"confidence":"High", "entityType":"PopulatedPlace", "geocodePoints":[ { "type":"Point", "coordinates":[ 44.943821, -93.093323 ], "calculationMethod":"Rooftop", "usageTypes":[ "Display" ] } ], "matchCodes":[ "Good" ] }, "itineraryItems":[ { "compassDirection":"northeast", "details":[ { "compassDegrees":41, "endPathIndices":[ 2 ], "locationCodes":[ "118+05098", "118P05098" ], "maneuverType":"DepartStart", "mode":"Driving", 243

"names":[ "S 3RD Ave" ], "roadType":"MajorRoad", "startPathIndices":[ 0 ] } ], "exit":"", "iconType":"Auto", "instruction":{ "maneuverType":"DepartStart", "text":"Depart S 3RD Ave toward S Washington Ave \/ CR-152 South" }, "maneuverPoint":{ "type":"Point", "coordinates":[ 44.979063, -93.264908 ] }, "sideOfStreet":"Unknown", "tollZone":"", "towardsRoadName":"S Washington Ave \/ CR-152 South", "transitTerminus":"", "travelDistance":0.118, "travelDuration":30, "travelMode":"Driving" }, { "compassDirection":"southeast", "details":[ 244

{ "compassDegrees":113, "endPathIndices":[ 11 ], "locationCodes":[ "118-06272", "118N06272", "118-05155", "118-05154", "118N05154", "118-05153" ], "maneuverType":"TurnRight", "mode":"Driving", "names":[ "S Washington Ave" ], "roadShieldRequestParameters":{ "bucket":50428, "shields":[ { "labels":[ "65" ], "roadShieldType":3 } ] }, "roadType":"Arterial", "startPathIndices":[ 2 ] } 245

], "exit":"", "iconType":"Auto", "instruction":{ "maneuverType":"TurnRight", "text":"Turn right onto MN-65 South \/ S Washington Ave" }, "maneuverPoint":{ "type":"Point", "coordinates":[ 44.979942, -93.264141 ] }, "sideOfStreet":"Unknown", "tollZone":"", "transitTerminus":"", "travelDistance":1.843, "travelDuration":251, "travelMode":"Driving" }, { "compassDirection":"east", "details":[ { "compassDegrees":112, "endPathIndices":[ 13 ], "locationCodes":[ "118N15600", "118-15599" ], "maneuverType":"TurnLeft", 246

"mode":"Driving", "names":[ "Riverside Ave" ], "roadType":"Arterial", "startPathIndices":[ 11 ] } ], "exit":"", "iconType":"Auto", "instruction":{ "maneuverType":"TurnLeft", "text":"Turn left onto Riverside Ave \/ CR-48" }, "maneuverPoint":{ "type":"Point", "coordinates":[ 44.970222, -93.24727 ] }, "sideOfStreet":"Unknown", "tollZone":"", "transitTerminus":"", "travelDistance":1.027, "travelDuration":169, "travelMode":"Driving" }, { "compassDirection":"southeast", "details":[ { 247

"compassDegrees":114, "endPathIndices":[ 15 ], "maneuverType":"KeepStraight", "mode":"Driving", "names":[ "Riverside Ave" ], "roadType":"Arterial", "startPathIndices":[ 13 ] } ], "exit":"", "iconType":"Auto", "instruction":{ "maneuverType":"KeepStraight", "text":"Keep straight onto Riverside Ave" }, "maneuverPoint":{ "type":"Point", "coordinates":[ 44.965491, -93.23616 ] }, "sideOfStreet":"Unknown", "tollZone":"", "transitTerminus":"", "travelDistance":0.325, "travelDuration":43, "travelMode":"Driving" 248

}, { "compassDirection":"east", "details":[ { "compassDegrees":86, "endPathIndices":[ 19 ], "maneuverType":"TakeRampLeft", "mode":"Driving", "roadType":"Ramp", "startPathIndices":[ 15 ] }, { "compassDegrees":68, "endPathIndices":[ 48 ], "locationCodes":[ "118-04195", "118N04195", "118-04194", "118N04194", "118-04193", "118N04193", "118-04192", "118N04192", "118-04191", "118N04191", "118-04190", "118N04190", 249

"118-04189", "118N04189", "118-04188", "118N04188" ], "maneuverType":"Merge", "mode":"Driving", "names":[ "Cappelen Memorial Bridge" ], "roadShieldRequestParameters":{ "bucket":50402, "shields":[ { "labels":[ "94" ], "roadShieldType":1 } ] }, "roadType":"LimitedAccessHighway", "startPathIndices":[ 19 ] } ], "exit":"", "iconType":"Auto", "instruction":{ "maneuverType":"RampThenHighwayLeft", "text":"Take ramp left and follow signs for I-94 East" }, "maneuverPoint":{ 250

"type":"Point", "coordinates":[ 44.964021, -93.232668 ] }, "sideOfStreet":"Unknown", "signs":[ "I-94 East" ], "tollZone":"", "transitTerminus":"", "travelDistance":9.94, "travelDuration":373, "travelMode":"Driving" }, { "compassDirection":"southeast", "details":[ { "compassDegrees":105, "endPathIndices":[ 55 ], "locationCodes":[ "118P15998", "118+15999" ], "maneuverType":"TakeRampRight", "mode":"Driving", "roadType":"Ramp", "startPathIndices":[ 48 ] 251

}, { "compassDegrees":125, "endPathIndices":[ 60 ], "locationCodes":[ "118+15999", "118P15999", "118+16000" ], "maneuverType":"Merge", "mode":"Driving", "names":[ "5TH St W" ], "roadType":"Arterial", "startPathIndices":[ 55 ] } ], "exit":"241B", "iconType":"Auto", "instruction":{ "maneuverType":"RampThenHighwayRight", "text":"At exit 241B, take ramp right and follow signs for 5th St" }, "maneuverPoint":{ "type":"Point", "coordinates":[ 44.950942, -93.11435 252

] }, "sideOfStreet":"Unknown", "signs":[ "5th St" ], "tollZone":"", "transitTerminus":"", "travelDistance":1.692, "travelDuration":169, "travelMode":"Driving" }, { "compassDirection":"southeast", "details":[ { "compassDegrees":135, "endPathIndices":[ 63 ], "locationCodes":[ "118-16685", "118N16685" ], "maneuverType":"BearRight", "mode":"Driving", "names":[ "St Peter St" ], "roadType":"Arterial", "startPathIndices":[ 60 ] } 253

], "exit":"", "iconType":"Auto", "instruction":{ "maneuverType":"BearRight", "text":"Bear right onto St Peter St" }, "maneuverPoint":{ "type":"Point", "coordinates":[ 44.945138, -93.095602 ] }, "sideOfStreet":"Unknown", "tollZone":"", "transitTerminus":"", "travelDistance":0.191, "travelDuration":18, "travelMode":"Driving" }, { "compassDirection":"east", "details":[ { "compassDegrees":87, "endPathIndices":[ 66 ], "locationCodes":[ "118+16420" ], "maneuverType":"BearLeft", "mode":"Driving", 254

"names":[ "Kellogg Blvd W" ], "roadType":"Arterial", "startPathIndices":[ 63 ] } ], "exit":"", "iconType":"Auto", "instruction":{ "maneuverType":"BearLeft", "text":"Bear left onto Kellogg Blvd W" }, "maneuverPoint":{ "type":"Point", "coordinates":[ 44.943738, -93.09425 ] }, "sideOfStreet":"Unknown", "tollZone":"", "transitTerminus":"", "travelDistance":0.075, "travelDuration":27, "travelMode":"Driving" }, { "compassDirection":"east", "details":[ { "compassDegrees":80, 255

"endPathIndices":[ 66 ], "locationCodes":[ "118+16420" ], "maneuverType":"ArriveFinish", "mode":"Driving", "names":[ "Kellogg Blvd W" ], "roadType":"Arterial", "startPathIndices":[ 66 ] } ], "exit":"", "hints":[ { "hintType":null, "text":"The last intersection is St Peter St" }, { "hintType":null, "text":"If you reach Kellogg Blvd E, you've gone too far" } ], "iconType":"Auto", "instruction":{ "maneuverType":"ArriveFinish", "text":"Arrive at St Paul, MN" }, 256

"maneuverPoint":{ "type":"Point", "coordinates":[ 44.943829, -93.093325 ] }, "sideOfStreet":"Unknown", "tollZone":"", "transitTerminus":"", "travelDistance":0, "travelDuration":0, "travelMode":"Driving" } ], "startLocation":{ "bbox":[ 44.629471, -94.065819, 45.322296, -92.481316 ], "name":"Minneapolis, MN", "point":{ "type":"Point", "coordinates":[ 44.979031, -93.264931 ] }, "address":{ "adminDistrict":"MN", "adminDistrict2":"Hennepin Co.", "countryRegion":"United States", 257

"formattedAddress":"Minneapolis, MN", "locality":"Minneapolis" }, "confidence":"High", "entityType":"PopulatedPlace", "geocodePoints":[ { "type":"Point", "coordinates":[ 44.979031, -93.264931 ], "calculationMethod":"Rooftop", "usageTypes":[ "Display" ] } ], "matchCodes":[ "Good" ] }, "travelDistance":15.211, "travelDuration":1084 } ], "routePath":{ "generalizations":[

], "line":{ "type":"LineString", "coordinates":[ [ 258

44.979062, -93.264908 ], [ 44.979668, -93.264377 ], [ 44.979942, -93.264141 ], [ 44.97969, -93.26355 ], [ 44.977678, -93.258621 ], [ 44.975329, -93.253208 ], [ 44.974341, -93.250869 ], [ 44.97424, -93.25044 ], [ 44.97292, -93.247398 259

], [ 44.972807, -93.24728 ], [ 44.972512, -93.24721 ], [ 44.970222, -93.247269 ], [ 44.970012, -93.246787 ], [ 44.96549, -93.23616 ], [ 44.965281, -93.235698 ], [ 44.96402, -93.232668 ], [ 44.964069, -93.231868 ], [ 260

44.964138, -93.230688 ], [ 44.964321, -93.229728 ], [ 44.964841, -93.228521 ], [ 44.964938, -93.228279 ], [ 44.966611, -93.22468 ], [ 44.966912, -93.22372 ], [ 44.967067, -93.22277 ], [ 44.9671, -93.221687 ], [ 44.966788, -93.219729 261

], [ 44.966091, -93.218007 ], [ 44.965378, -93.216971 ], [ 44.962041, -93.21268 ], [ 44.960651, -93.210518 ], [ 44.960002, -93.209289 ], [ 44.959707, -93.208227 ], [ 44.959589, -93.207149 ], [ 44.959718, -93.202407 ], [ 262

44.959638, -93.20157 ], [ 44.95945, -93.20076 ], [ 44.959198, -93.200111 ], [ 44.958087, -93.198169 ], [ 44.957379, -93.196361 ], [ 44.954289, -93.187381 ], [ 44.95327, -93.1842 ], [ 44.95217, -93.180638 ], [ 44.951881, -93.178997 263

], [ 44.951591, -93.167238 ], [ 44.951682, -93.154079 ], [ 44.951612, -93.148178 ], [ 44.951661, -93.121747 ], [ 44.951521, -93.119371 ], [ 44.950942, -93.11435 ], [ 44.950781, -93.11376 ], [ 44.950631, -93.112451 ], [ 264

44.950529, -93.109887 ], [ 44.95032, -93.108782 ], [ 44.949799, -93.10772 ], [ 44.948979, -93.106437 ], [ 44.94782, -93.104361 ], [ 44.94738, -93.10375 ], [ 44.945889, -93.101647 ], [ 44.945508, -93.100708 ], [ 44.945138, -93.097549 265

], [ 44.945138, -93.095601 ], [ 44.944311, -93.094781 ], [ 44.944081, -93.094561 ], [ 44.943737, -93.094249 ], [ 44.943759, -93.093842 ], [ 44.943791, -93.093541 ], [ 44.943828, -93.093324 ] ] } }, "travelDistance":15.211, "travelDuration":1084 266

} ] } ], "statusCode":200, "statusDescription":"OK", "traceId":"d26976daf98947baa178bd6eebc499df" }

XML Response You would receive the following XML response if the output (o) parameter was set to XML in the request.
<Response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/search/local/ws/rest/v1"> <Copyright> Copyright 2011 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation. </Copyright> <BrandLogoUri> http://dev.virtualearth.net/Branding/logo_powered_by.png </BrandLogoUri> <StatusCode>200</StatusCode> <StatusDescription>OK</StatusDescription> <AuthenticationResultCode>ValidCredentials</AuthenticationResultCode> <TraceId> 6528dc5e7ea3411783efeff83222c606 </TraceId> <ResourceSets> <ResourceSet> <EstimatedTotal>1</EstimatedTotal> <Resources> <Route> <Id>

267

v62,i0,a0,cenUS,dAAAAAAAAAAA=,y0,s1,m1,o2,t4,w2YX/A2a0tfc=~XpeTlHEqBQgAAOABAAAAAAA=~TWlubmVhcG9saXMsIE 1O~~~,wvLj+Axacufc=~XpeTlAElEggAAOAB1BkBPwA=~U3QgUGF1bCwgTU4=~~~,k1,u </Id> <BoundingBox> <SouthLatitude>44.943738</SouthLatitude> <WestLongitude>-93.264908</WestLongitude> <NorthLatitude>44.979942</NorthLatitude> <EastLongitude>-93.093325</EastLongitude> </BoundingBox> <DistanceUnit>Kilometer</DistanceUnit> <DurationUnit>Second</DurationUnit> <TravelDistance>15.211</TravelDistance> <TravelDuration>1084</TravelDuration> <RouteLeg> <TravelDistance>15.211</TravelDistance> <TravelDuration>1084</TravelDuration> <ActualStart> <Latitude>44.979063</Latitude> <Longitude>-93.264908</Longitude> </ActualStart> <ActualEnd> <Latitude>44.943829</Latitude> <Longitude>-93.093325</Longitude> </ActualEnd> <StartLocation> <Name>Minneapolis, MN</Name> <Point> <Latitude>44.979031</Latitude> <Longitude>-93.264931</Longitude> </Point> <BoundingBox> <SouthLatitude>44.629471</SouthLatitude> <WestLongitude>-94.065819</WestLongitude> 268

<NorthLatitude>45.322296</NorthLatitude> <EastLongitude>-92.481316</EastLongitude> </BoundingBox> <EntityType>PopulatedPlace</EntityType> <Address> <AdminDistrict>MN</AdminDistrict> <AdminDistrict2>Hennepin Co.</AdminDistrict2> <CountryRegion>United States</CountryRegion> <FormattedAddress>Minneapolis, MN</FormattedAddress> <Locality>Minneapolis</Locality> </Address> <Confidence>High</Confidence> <MatchCode>Good</MatchCode> <GeocodePoint> <Latitude>44.979031</Latitude> <Longitude>-93.264931</Longitude> <CalculationMethod>Rooftop</CalculationMethod> <UsageType>Display</UsageType> </GeocodePoint> </StartLocation> <EndLocation> <Name>St Paul, MN</Name> <Point> <Latitude>44.943821</Latitude> <Longitude>-93.093323</Longitude> </Point> <BoundingBox> <SouthLatitude>44.607239</SouthLatitude> <WestLongitude>-93.884979</WestLongitude> <NorthLatitude>45.300064</NorthLatitude> <EastLongitude>-92.301086</EastLongitude> </BoundingBox> <EntityType>PopulatedPlace</EntityType> <Address> 269

<AdminDistrict>MN</AdminDistrict> <AdminDistrict2>Ramsey Co.</AdminDistrict2> <CountryRegion>United States</CountryRegion> <FormattedAddress>St Paul, MN</FormattedAddress> <Locality>St Paul</Locality> </Address> <Confidence>High</Confidence> <MatchCode>Good</MatchCode> <GeocodePoint> <Latitude>44.943821</Latitude> <Longitude>-93.093323</Longitude> <CalculationMethod>Rooftop</CalculationMethod> <UsageType>Display</UsageType> </GeocodePoint> </EndLocation> <ItineraryItem> <TravelMode>Driving</TravelMode> <TravelDistance>0.118</TravelDistance> <TravelDuration>30</TravelDuration> <ManeuverPoint> <Latitude>44.979063</Latitude> <Longitude>-93.264908</Longitude> </ManeuverPoint> <Instruction maneuverType="DepartStart"> Depart S 3RD Ave toward S Washington Ave / CR-152 South </Instruction> <CompassDirection>northeast</CompassDirection> <Detail> <ManeuverType>DepartStart</ManeuverType> <StartPathIndex>0</StartPathIndex> <EndPathIndex>2</EndPathIndex> <Name>S 3RD Ave</Name> <CompassDegrees>41</CompassDegrees> <Mode>Driving</Mode> 270

<PreviousEntityId>0</PreviousEntityId> <NextEntityId>0</NextEntityId> <RoadType>MajorRoad</RoadType> <LocationCode>118+05098</LocationCode> <LocationCode>118P05098</LocationCode> </Detail> <Exit/> <TollZone/> <TransitTerminus/> <IconType>Auto</IconType> <Time>0001-01-01T00:00:00</Time> <TransitStopId>0</TransitStopId> <TowardsRoadName>S Washington Ave / CR-152 South</TowardsRoadName> <SideOfStreet>Unknown</SideOfStreet> </ItineraryItem> <ItineraryItem> <TravelMode>Driving</TravelMode> <TravelDistance>1.843</TravelDistance> <TravelDuration>251</TravelDuration> <ManeuverPoint> <Latitude>44.979942</Latitude> <Longitude>-93.264141</Longitude> </ManeuverPoint> <Instruction maneuverType="TurnRight">Turn right onto MN-65 South / S Washington Ave</Instruction> <CompassDirection>southeast</CompassDirection> <Detail> <ManeuverType>TurnRight</ManeuverType> <StartPathIndex>2</StartPathIndex> <EndPathIndex>11</EndPathIndex> <Name>S Washington Ave</Name> <CompassDegrees>113</CompassDegrees> <Mode>Driving</Mode> <PreviousEntityId>0</PreviousEntityId> 271

<NextEntityId>0</NextEntityId> <RoadType>Arterial</RoadType> <RoadShieldRequestParameters> <Bucket>50428</Bucket> <Shield> <RoadShieldType>3</RoadShieldType> <Label>65</Label> </Shield> </RoadShieldRequestParameters> <LocationCode>118-06272</LocationCode> <LocationCode>118N06272</LocationCode> <LocationCode>118-05155</LocationCode> <LocationCode>118-05154</LocationCode> <LocationCode>118N05154</LocationCode> <LocationCode>118-05153</LocationCode> </Detail> <Exit/> <TollZone/> <TransitTerminus/> <IconType>Auto</IconType> <Time>0001-01-01T00:00:00</Time> <TransitStopId>0</TransitStopId> <SideOfStreet>Unknown</SideOfStreet> </ItineraryItem> <ItineraryItem> <TravelMode>Driving</TravelMode> <TravelDistance>1.027</TravelDistance> <TravelDuration>169</TravelDuration> <ManeuverPoint> <Latitude>44.970222</Latitude> <Longitude>-93.24727</Longitude> </ManeuverPoint> <Instruction maneuverType="TurnLeft">Turn left onto Riverside Ave / CR48</Instruction> 272

<CompassDirection>east</CompassDirection> <Detail> <ManeuverType>TurnLeft</ManeuverType> <StartPathIndex>11</StartPathIndex> <EndPathIndex>13</EndPathIndex> <Name>Riverside Ave</Name> <CompassDegrees>112</CompassDegrees> <Mode>Driving</Mode> <PreviousEntityId>0</PreviousEntityId> <NextEntityId>0</NextEntityId> <RoadType>Arterial</RoadType> <LocationCode>118N15600</LocationCode> <LocationCode>118-15599</LocationCode> </Detail> <Exit/> <TollZone/> <TransitTerminus/> <IconType>Auto</IconType> <Time>0001-01-01T00:00:00</Time> <TransitStopId>0</TransitStopId> <SideOfStreet>Unknown</SideOfStreet> </ItineraryItem> <ItineraryItem> <TravelMode>Driving</TravelMode> <TravelDistance>0.325</TravelDistance> <TravelDuration>43</TravelDuration> <ManeuverPoint> <Latitude>44.965491</Latitude> <Longitude>-93.23616</Longitude> </ManeuverPoint> <Instruction maneuverType="KeepStraight">Keep straight onto Riverside Ave</Instruction> <CompassDirection>southeast</CompassDirection> <Detail> 273

<ManeuverType>KeepStraight</ManeuverType> <StartPathIndex>13</StartPathIndex> <EndPathIndex>15</EndPathIndex> <Name>Riverside Ave</Name> <CompassDegrees>114</CompassDegrees> <Mode>Driving</Mode> <PreviousEntityId>0</PreviousEntityId> <NextEntityId>0</NextEntityId> <RoadType>Arterial</RoadType> </Detail> <Exit/> <TollZone/> <TransitTerminus/> <IconType>Auto</IconType> <Time>0001-01-01T00:00:00</Time> <TransitStopId>0</TransitStopId> <SideOfStreet>Unknown</SideOfStreet> </ItineraryItem> <ItineraryItem> <TravelMode>Driving</TravelMode> <TravelDistance>9.94</TravelDistance> <TravelDuration>373</TravelDuration> <ManeuverPoint> <Latitude>44.964021</Latitude> <Longitude>-93.232668</Longitude> </ManeuverPoint> <Instruction maneuverType="RampThenHighwayLeft">Take ramp left and follow signs for I-94 East</Instruction> <CompassDirection>east</CompassDirection> <Detail> <ManeuverType>TakeRampLeft</ManeuverType> <StartPathIndex>15</StartPathIndex> <EndPathIndex>19</EndPathIndex> <CompassDegrees>86</CompassDegrees> 274

<Mode>Driving</Mode> <PreviousEntityId>0</PreviousEntityId> <NextEntityId>0</NextEntityId> <RoadType>Ramp</RoadType> </Detail> <Detail> <ManeuverType>Merge</ManeuverType> <StartPathIndex>19</StartPathIndex> <EndPathIndex>48</EndPathIndex> <Name>Cappelen Memorial Bridge</Name> <CompassDegrees>68</CompassDegrees> <Mode>Driving</Mode> <PreviousEntityId>0</PreviousEntityId> <NextEntityId>0</NextEntityId> <RoadType>LimitedAccessHighway</RoadType> <RoadShieldRequestParameters> <Bucket>50402</Bucket> <Shield> <RoadShieldType>1</RoadShieldType> <Label>94</Label> </Shield> </RoadShieldRequestParameters> <LocationCode>118-04195</LocationCode> <LocationCode>118N04195</LocationCode> <LocationCode>118-04194</LocationCode> <LocationCode>118N04194</LocationCode> <LocationCode>118-04193</LocationCode> <LocationCode>118N04193</LocationCode> <LocationCode>118-04192</LocationCode> <LocationCode>118N04192</LocationCode> <LocationCode>118-04191</LocationCode> <LocationCode>118N04191</LocationCode> <LocationCode>118-04190</LocationCode> <LocationCode>118N04190</LocationCode> 275

<LocationCode>118-04189</LocationCode> <LocationCode>118N04189</LocationCode> <LocationCode>118-04188</LocationCode> <LocationCode>118N04188</LocationCode> </Detail> <Sign>I-94 East</Sign> <Exit/> <TollZone/> <TransitTerminus/> <IconType>Auto</IconType> <Time>0001-01-01T00:00:00</Time> <TransitStopId>0</TransitStopId> <SideOfStreet>Unknown</SideOfStreet> </ItineraryItem> <ItineraryItem> <TravelMode>Driving</TravelMode> <TravelDistance>1.692</TravelDistance> <TravelDuration>169</TravelDuration> <ManeuverPoint> <Latitude>44.950942</Latitude> <Longitude>-93.11435</Longitude> </ManeuverPoint> <Instruction maneuverType="RampThenHighwayRight"> At exit 241B, take ramp right and follow signs for 5th St </Instruction> <CompassDirection>southeast</CompassDirection> <Detail> <ManeuverType>TakeRampRight</ManeuverType> <StartPathIndex>48</StartPathIndex> <EndPathIndex>55</EndPathIndex> <CompassDegrees>105</CompassDegrees> <Mode>Driving</Mode> <PreviousEntityId>0</PreviousEntityId> <NextEntityId>0</NextEntityId> 276

<RoadType>Ramp</RoadType> <LocationCode>118P15998</LocationCode> <LocationCode>118+15999</LocationCode> </Detail> <Detail> <ManeuverType>Merge</ManeuverType> <StartPathIndex>55</StartPathIndex> <EndPathIndex>60</EndPathIndex> <Name>5TH St W</Name> <CompassDegrees>125</CompassDegrees> <Mode>Driving</Mode> <PreviousEntityId>0</PreviousEntityId> <NextEntityId>0</NextEntityId> <RoadType>Arterial</RoadType> <LocationCode>118+15999</LocationCode> <LocationCode>118P15999</LocationCode> <LocationCode>118+16000</LocationCode> </Detail> <Sign>5th St</Sign> <Exit>241B</Exit> <TollZone/> <TransitTerminus/> <IconType>Auto</IconType> <Time>0001-01-01T00:00:00</Time> <TransitStopId>0</TransitStopId> <SideOfStreet>Unknown</SideOfStreet> </ItineraryItem> <ItineraryItem> <TravelMode>Driving</TravelMode> <TravelDistance>0.191</TravelDistance> <TravelDuration>18</TravelDuration> <ManeuverPoint> <Latitude>44.945138</Latitude> <Longitude>-93.095602</Longitude> 277

</ManeuverPoint> <Instruction maneuverType="BearRight">Bear right onto St Peter St</Instruction> <CompassDirection>southeast</CompassDirection> <Detail> <ManeuverType>BearRight</ManeuverType> <StartPathIndex>60</StartPathIndex> <EndPathIndex>63</EndPathIndex> <Name>St Peter St</Name> <CompassDegrees>135</CompassDegrees> <Mode>Driving</Mode> <PreviousEntityId>0</PreviousEntityId> <NextEntityId>0</NextEntityId> <RoadType>Arterial</RoadType> <LocationCode>118-16685</LocationCode> <LocationCode>118N16685</LocationCode> </Detail> <Exit/> <TollZone/> <TransitTerminus/> <IconType>Auto</IconType> <Time>0001-01-01T00:00:00</Time> <TransitStopId>0</TransitStopId> <SideOfStreet>Unknown</SideOfStreet> </ItineraryItem> <ItineraryItem> <TravelMode>Driving</TravelMode> <TravelDistance>0.075</TravelDistance> <TravelDuration>27</TravelDuration> <ManeuverPoint> <Latitude>44.943738</Latitude> <Longitude>-93.09425</Longitude> </ManeuverPoint>

278

<Instruction maneuverType="BearLeft">Bear left onto Kellogg Blvd W</Instruction> <CompassDirection>east</CompassDirection> <Detail> <ManeuverType>BearLeft</ManeuverType> <StartPathIndex>63</StartPathIndex> <EndPathIndex>66</EndPathIndex> <Name>Kellogg Blvd W</Name> <CompassDegrees>87</CompassDegrees> <Mode>Driving</Mode> <PreviousEntityId>0</PreviousEntityId> <NextEntityId>0</NextEntityId> <RoadType>Arterial</RoadType> <LocationCode>118+16420</LocationCode> </Detail> <Exit/> <TollZone/> <TransitTerminus/> <IconType>Auto</IconType> <Time>0001-01-01T00:00:00</Time> <TransitStopId>0</TransitStopId> <SideOfStreet>Unknown</SideOfStreet> </ItineraryItem> <ItineraryItem> <TravelMode>Driving</TravelMode> <TravelDistance>0</TravelDistance> <TravelDuration>0</TravelDuration> <ManeuverPoint> <Latitude>44.943829</Latitude> <Longitude>-93.093325</Longitude> </ManeuverPoint> <Instruction maneuverType="ArriveFinish">Arrive at St Paul, MN</Instruction> <CompassDirection>east</CompassDirection> 279

<Hint>The last intersection is St Peter St</Hint> <Hint>If you reach Kellogg Blvd E, you've gone too far</Hint> <Detail> <ManeuverType>ArriveFinish</ManeuverType> <StartPathIndex>66</StartPathIndex> <EndPathIndex>66</EndPathIndex> <Name>Kellogg Blvd W</Name> <CompassDegrees>80</CompassDegrees> <Mode>Driving</Mode> <PreviousEntityId>0</PreviousEntityId> <NextEntityId>0</NextEntityId> <RoadType>Arterial</RoadType> <LocationCode>118+16420</LocationCode> </Detail> <Exit/> <TollZone/> <TransitTerminus/> <IconType>Auto</IconType> <Time>0001-01-01T00:00:00</Time> <TransitStopId>0</TransitStopId> <SideOfStreet>Unknown</SideOfStreet> </ItineraryItem> <StartTime>0001-01-01T00:00:00</StartTime> <EndTime>0001-01-01T00:00:00</EndTime> </RouteLeg> <RoutePath> <Line> <Point> <Latitude>44.979062</Latitude> <Longitude>-93.264908</Longitude> </Point> <Point> <Latitude>44.979668</Latitude> <Longitude>-93.264377</Longitude> 280

</Point> <Point> <Latitude>44.979942</Latitude> <Longitude>-93.264141</Longitude> </Point> <Point> <Latitude>44.97969</Latitude> <Longitude>-93.26355</Longitude> </Point> <Point> <Latitude>44.977678</Latitude> <Longitude>-93.258621</Longitude> </Point> <Point> <Latitude>44.975329</Latitude> <Longitude>-93.253208</Longitude> </Point> <Point> <Latitude>44.974341</Latitude> <Longitude>-93.250869</Longitude> </Point> <Point> <Latitude>44.97424</Latitude> <Longitude>-93.25044</Longitude> </Point> <Point> <Latitude>44.97292</Latitude> <Longitude>-93.247398</Longitude> </Point> <Point> <Latitude>44.972807</Latitude> <Longitude>-93.24728</Longitude> </Point> <Point> 281

<Latitude>44.972512</Latitude> <Longitude>-93.24721</Longitude> </Point> <Point> <Latitude>44.970222</Latitude> <Longitude>-93.247269</Longitude> </Point> <Point> <Latitude>44.970012</Latitude> <Longitude>-93.246787</Longitude> </Point> <Point> <Latitude>44.96549</Latitude> <Longitude>-93.23616</Longitude> </Point> <Point> <Latitude>44.965281</Latitude> <Longitude>-93.235698</Longitude> </Point> <Point> <Latitude>44.96402</Latitude> <Longitude>-93.232668</Longitude> </Point> <Point> <Latitude>44.964069</Latitude> <Longitude>-93.231868</Longitude> </Point> <Point> <Latitude>44.964138</Latitude> <Longitude>-93.230688</Longitude> </Point> <Point> <Latitude>44.964321</Latitude> <Longitude>-93.229728</Longitude> 282

</Point> <Point> <Latitude>44.964841</Latitude> <Longitude>-93.228521</Longitude> </Point> <Point> <Latitude>44.964938</Latitude> <Longitude>-93.228279</Longitude> </Point> <Point> <Latitude>44.966611</Latitude> <Longitude>-93.22468</Longitude> </Point> <Point> <Latitude>44.966912</Latitude> <Longitude>-93.22372</Longitude> </Point> <Point> <Latitude>44.967067</Latitude> <Longitude>-93.22277</Longitude> </Point> <Point> <Latitude>44.9671</Latitude> <Longitude>-93.221687</Longitude> </Point> <Point> <Latitude>44.966788</Latitude> <Longitude>-93.219729</Longitude> </Point> <Point> <Latitude>44.966091</Latitude> <Longitude>-93.218007</Longitude> </Point> <Point> 283

<Latitude>44.965378</Latitude> <Longitude>-93.216971</Longitude> </Point> <Point> <Latitude>44.962041</Latitude> <Longitude>-93.21268</Longitude> </Point> <Point> <Latitude>44.960651</Latitude> <Longitude>-93.210518</Longitude> </Point> <Point> <Latitude>44.960002</Latitude> <Longitude>-93.209289</Longitude> </Point> <Point> <Latitude>44.959707</Latitude> <Longitude>-93.208227</Longitude> </Point> <Point> <Latitude>44.959589</Latitude> <Longitude>-93.207149</Longitude> </Point> <Point> <Latitude>44.959718</Latitude> <Longitude>-93.202407</Longitude> </Point> <Point> <Latitude>44.959638</Latitude> <Longitude>-93.20157</Longitude> </Point> <Point> <Latitude>44.95945</Latitude> <Longitude>-93.20076</Longitude> 284

</Point> <Point> <Latitude>44.959198</Latitude> <Longitude>-93.200111</Longitude> </Point> <Point> <Latitude>44.958087</Latitude> <Longitude>-93.198169</Longitude> </Point> <Point> <Latitude>44.957379</Latitude> <Longitude>-93.196361</Longitude> </Point> <Point> <Latitude>44.954289</Latitude> <Longitude>-93.187381</Longitude> </Point> <Point> <Latitude>44.95327</Latitude> <Longitude>-93.1842</Longitude> </Point> <Point> <Latitude>44.95217</Latitude> <Longitude>-93.180638</Longitude> </Point> <Point> <Latitude>44.951881</Latitude> <Longitude>-93.178997</Longitude> </Point> <Point> <Latitude>44.951591</Latitude> <Longitude>-93.167238</Longitude> </Point> <Point> 285

<Latitude>44.951682</Latitude> <Longitude>-93.154079</Longitude> </Point> <Point> <Latitude>44.951612</Latitude> <Longitude>-93.148178</Longitude> </Point> <Point> <Latitude>44.951661</Latitude> <Longitude>-93.121747</Longitude> </Point> <Point> <Latitude>44.951521</Latitude> <Longitude>-93.119371</Longitude> </Point> <Point> <Latitude>44.950942</Latitude> <Longitude>-93.11435</Longitude> </Point> <Point> <Latitude>44.950781</Latitude> <Longitude>-93.11376</Longitude> </Point> <Point> <Latitude>44.950631</Latitude> <Longitude>-93.112451</Longitude> </Point> <Point> <Latitude>44.950529</Latitude> <Longitude>-93.109887</Longitude> </Point> <Point> <Latitude>44.95032</Latitude> <Longitude>-93.108782</Longitude> 286

</Point> <Point> <Latitude>44.949799</Latitude> <Longitude>-93.10772</Longitude> </Point> <Point> <Latitude>44.948979</Latitude> <Longitude>-93.106437</Longitude> </Point> <Point> <Latitude>44.94782</Latitude> <Longitude>-93.104361</Longitude> </Point> <Point> <Latitude>44.94738</Latitude> <Longitude>-93.10375</Longitude> </Point> <Point> <Latitude>44.945889</Latitude> <Longitude>-93.101647</Longitude> </Point> <Point> <Latitude>44.945508</Latitude> <Longitude>-93.100708</Longitude> </Point> <Point> <Latitude>44.945138</Latitude> <Longitude>-93.097549</Longitude> </Point> <Point> <Latitude>44.945138</Latitude> <Longitude>-93.095601</Longitude> </Point> <Point> 287

<Latitude>44.944311</Latitude> <Longitude>-93.094781</Longitude> </Point> <Point> <Latitude>44.944081</Latitude> <Longitude>-93.094561</Longitude> </Point> <Point> <Latitude>44.943737</Latitude> <Longitude>-93.094249</Longitude> </Point> <Point> <Latitude>44.943759</Latitude> <Longitude>-93.093842</Longitude> </Point> <Point> <Latitude>44.943791</Latitude> <Longitude>-93.093541</Longitude> </Point> <Point> <Latitude>44.943828</Latitude> <Longitude>-93.093324</Longitude> </Point> </Line> </RoutePath> </Route> </Resources> </ResourceSet> </ResourceSets> </Response>

288

Driving Route using Tolerances Example


The following example shows how to request a driving route between two locations and specifies tolerances so that subsets of route points that meet those tolerances are returned. Each tolerance returns a subset of route points in the response. The route path defined by the subset of route path points approximates the route path defined by the full set of route points within the tolerance provided. The response to this request is the same as are shown for both XML and JSON formats. This example is the same as the request that is described in the Driving Route with Route Path Example with the addition of tolerances. Examples of the additional content that is returned when tolerances are specified are shown below in JSON and XML formats.
http://dev.virtualearth.net/REST/V1/Routes/Driving?wp.0=44.979035,93.26493&wp.1=44.943828508257866,93.09332862496376&optmz=distance&rpo=Points&tl=0.00000344978,0.0000218840,0.000220577,0.0 0188803,0.0169860,0.0950130,0.846703&key=BingMapsKey

JSON Response The following route path generalization collections are returned with the route path points in Route resource in the response. Each route path generalization specifies a subset of route path points and the associated tolerance (latLongTolerance). The route path points are specified by an index value. Route path points are assigned integer index values that start with 0. These generalizations would be added to the complete response shown in Driving Route with Route Path Example.
{ "routePath":{ -- route path points -"generalizations":[ { "latLongTolerance":3.44978E-06, "pathIndices":[

0,2,3,4,5,6,7,8,9,10,11,13,14,15,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,

33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59, 60,61,62,63,64,65,66] }, { "latLongTolerance":2.1884E-05, "pathIndices":[

289

0,2,4,5,6,7,8,9,10,11,14,15,17,18,20,21,22,23,24,25,26,27,28,29,30,31, 32,33,34,35,36,37,38,39,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,57, 58,59,60,63,66 ] }, { "latLongTolerance":0.000220577, "pathIndices":[ 0,2,8,11,15,18,22,24,25,26,28,30,32,33,35,38,41,43,47,52,57,58,60,63,66 ] }, { "latLongTolerance":0.00188803, "pathIndices":[ 0,15,25,30,41,47,66 ] }, { "latLongTolerance":0.016986, "pathIndices":[ 0,66 ] }, { "latLongTolerance":0.095013, "pathIndices":[ 0,66 ] }, { "latLongTolerance":0.846703, "pathIndices":[ 0,66 ] 290

} ] } }

XML Response You receive the following XML version of the route path generalizations when the output=xml parameter is set in the request.
<RoutePath> route path points -<RoutePathGeneralization> <Index>0</Index> <Index>2</Index> <Index>3</Index> <Index>4</Index> <Index>5</Index> <Index>6</Index> <Index>7</Index> <Index>8</Index> <Index>9</Index> <Index>10</Index> <Index>11</Index> <Index>13</Index> <Index>14</Index> <Index>15</Index> <Index>17</Index> <Index>18</Index> <Index>19</Index> <Index>20</Index> <Index>21</Index> <Index>22</Index> <Index>23</Index> <Index>24</Index> <Index>25</Index> <Index>26</Index> 291

<Index>27</Index> <Index>28</Index> <Index>29</Index> <Index>30</Index> <Index>31</Index> <Index>32</Index> <Index>33</Index> <Index>34</Index> <Index>35</Index> <Index>36</Index> <Index>37</Index> <Index>38</Index> <Index>39</Index> <Index>40</Index> <Index>41</Index> <Index>42</Index> <Index>43</Index> <Index>44</Index> <Index>45</Index> <Index>46</Index> <Index>47</Index> <Index>48</Index> <Index>49</Index> <Index>50</Index> <Index>51</Index> <Index>52</Index> <Index>53</Index> <Index>54</Index> <Index>55</Index> <Index>56</Index> <Index>57</Index> <Index>58</Index> <Index>59</Index> <Index>60</Index> 292

<Index>61</Index> <Index>62</Index> <Index>63</Index> <Index>64</Index> <Index>65</Index> <Index>66</Index> <LatLongTolerance>3.44978E-06</LatLongTolerance> </RoutePathGeneralization>-<RoutePathGeneralization> <Index>0</Index> <Index>2</Index> <Index>4</Index> <Index>5</Index> <Index>6</Index> <Index>7</Index> <Index>8</Index> <Index>9</Index> <Index>10</Index> <Index>11</Index> <Index>14</Index> <Index>15</Index> <Index>17</Index> <Index>18</Index> <Index>20</Index> <Index>21</Index> <Index>22</Index> <Index>23</Index> <Index>24</Index> <Index>25</Index> <Index>26</Index> <Index>27</Index> <Index>28</Index> <Index>29</Index> <Index>30</Index> <Index>31</Index> 293

<Index>32</Index> <Index>33</Index> <Index>34</Index> <Index>35</Index> <Index>36</Index> <Index>37</Index> <Index>38</Index> <Index>39</Index> <Index>41</Index> <Index>42</Index> <Index>43</Index> <Index>44</Index> <Index>45</Index> <Index>46</Index> <Index>47</Index> <Index>48</Index> <Index>49</Index> <Index>50</Index> <Index>51</Index> <Index>52</Index> <Index>53</Index> <Index>54</Index> <Index>55</Index> <Index>57</Index> <Index>58</Index> <Index>59</Index> <Index>60</Index> <Index>63</Index> <Index>66</Index> <LatLongTolerance>2.1884E-05</LatLongTolerance> </RoutePathGeneralization>-<RoutePathGeneralization> <Index>0</Index> <Index>2</Index> <Index>8</Index> 294

<Index>11</Index> <Index>15</Index> <Index>18</Index> <Index>22</Index> <Index>24</Index> <Index>25</Index> <Index>26</Index> <Index>28</Index> <Index>30</Index> <Index>32</Index> <Index>33</Index> <Index>35</Index> <Index>38</Index> <Index>41</Index> <Index>43</Index> <Index>47</Index> <Index>52</Index> <Index>57</Index> <Index>58</Index> <Index>60</Index> <Index>63</Index> <Index>66</Index> <LatLongTolerance>0.000220577</LatLongTolerance> </RoutePathGeneralization>-<RoutePathGeneralization> <Index>0</Index> <Index>15</Index> <Index>25</Index> <Index>30</Index> <Index>41</Index> <Index>47</Index> <Index>66</Index> <LatLongTolerance>0.00188803</LatLongTolerance> </RoutePathGeneralization>-<RoutePathGeneralization> <Index>0</Index> 295

<Index>66</Index> <LatLongTolerance>0.016986</LatLongTolerance> </RoutePathGeneralization>-<RoutePathGeneralization> <Index>0</Index> <Index>66</Index> <LatLongTolerance>0.095013</LatLongTolerance> </RoutePathGeneralization>-<RoutePathGeneralization> <Index>0</Index> <Index>66</Index> <LatLongTolerance>0.846703</LatLongTolerance> </RoutePathGeneralization> </RoutePath>

Calculate Routes from Major Roads


Use the following URL template to return a driving route to a location from major roads in four directions (West, North, East and South). You can use this URL for routes in the United States, Canada and Mexico. When you make a request using the following URL template, the response can return either only the starting points for the routes from major roads or detailed information for each route. Starting points are latitude and longitude pairs while detailed route information includes detailed directions and waypoints, travel time and duration and other information specific to the route. Specify the exclude parameter when you do not want to return detailed route information. Starting points are specified in the response by using the Location Resource. Detailed route information is provided by using the Route Resource. You can also request a route path that additionally returns a series of latitude and longitude points that define the route. For information about the Location Resource, see Location Data. For information about the Route Resource, see Route Data. Examples are also provided below. When you use this URL, an attempt is made to create four driving routes to the specified location. Ideally these routes are from the west, north, east and south directions. However, major routes may not exist in each direction. If routes from all four directions cannot be found, the response may contain more than one route from the same direction or fewer than four routes may be returned. For more information about the Route resource, see Route Data. You can also view the example URL and response values in the Examples section.

296

URL Templates
These templates support both HTTP and HTTPS protocols. Find routes from major roads in four directions (West, North, East, South).
http://dev.virtualearth.net/REST/v1/Routes/FromMajorRoads?destination=destination&exclude =routes&rpo=routePathOutput&du=distanceUnit&key=BingMapsKey

Template Parameters

See the Common Parameters and Types section for additional common parameters to use with these URLs. Common parameters include: Output Parameters: Includes response output types and the JSON callback parameters. Culture Parameter: Includes a list of the supported cultures. User Context Parameters: Includes parameters that set user location and viewport values to help determine locations. For example, these values may help prioritize a set of possible locations when you specify a partial address for a destination. When an alias is provided, you can use the alias to shorten the length of the query parameter. For example, destination=47.610,-122.107 can be shortened to dest=47.610,122.107. Parameter values are not case-sensitive.
Parameter Alia s Description Values

destination

dest

Required. Specifies the final location for all the routes.

A destination can be specified as a Point, a landmark, or an address. For more information about Point values, see Location and Area Types. Examples: destination=47.610,-122.107 [Point] destination=Eiffel%20Tower [landmark] dest=1%20Microsoft%20Way%20Redmond%20 WA [address]

exclude

excl

Optional. Specifies to return only starting points for each major route in the response.

The only value for this parameter is routes. Examples: exclude=routes

297

Parameter

Alia s

Description

Values

When this option is not excl=routes specified, detailed directions for each route are returned. routePathOutp ut rpo Optional. Specifies whether the response should include information about Point (latitude and longitude) values for each routes path. One of the following values: Points: A list of Point values for each routes path is provided in the response. None [default]: No route path information is provided in the response.

Example: routePathOutput=Points

When the exclude parameter is specified, the routePathOutp ut parameter is not used. distanceUnit du Optional. The units to use for distance. One of the following values: When the exclude parameter is specified, the distanceUnit parameter is not used. Mile or mi Kilometer or km [default]

Example: distanceUnit=mi

Response
A set of Route resources that contain route information from major roads is returned when you make a request using this template and do not specify the exclude=routes parameter value. If you specify the exclude=routes, a set of Location resources are returned that contain starting points (latitude and longitude values) for routes to your destination from major roads. For more information about the Route resource, see Route Data. For more information about the Locations resource, see Location Data. For more information about the common response syntax for the
298

Bing Maps REST Services, see Common Response Description. JSON and XML responses are provided for the URL examples in the following section. These URLs support JSON (application/json) and XML (application/xml) response formats. A JSON response is provided by default, unless you request XML output by setting the output (o) parameter. For more information, see Output Parameters.

Examples
Find starting points of the driving routes from major roads to a street address. This example returns starting points for routes from major roads for the specified street address. The exclude=routes parameter is specified so that only the starting points of the major routes are returned. If you do not include this parameter, detailed route instructions are also provided in the response.
http://dev.virtualearth.net/REST/V1/Routes/FromMajorRoads?dest=1%20Microsoft%20Way%20Redm ond%20WA%2098052&exclude=routes&output=xml&key=BingMapsKey

XML response The response for this example contains a set of Location resources that specify the starting points of the major routes. The Name field defines the route that corresponds with the starting location. For example, the first Name value below specifies that this is the starting point of a route from the north and uses Interstate I-405 South.
<Response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/search/local/ws/rest/v1"> <Copyright>Copyright 2010 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.</Copyright> <BrandLogoUri>http://veintplat3.liveint.com/Branding/logo_powered_by.png</BrandLogoUri> <StatusCode>200</StatusCode> <StatusDescription>OK</StatusDescription> <AuthenticationResultCode>ValidCredentials</AuthenticationResultCode> <TraceId>d9c83b7e348e41c0b93255e36cb944f3</TraceId> <ResourceSets> <ResourceSet> <EstimatedTotal>4</EstimatedTotal> <Resources> <Location>

299

<Name>the north (on I-405 S)</Name> <Point> <Latitude>47.684789299964905</Latitude> <Longitude>-122.18332171440125</Longitude> </Point> <Confidence>High</Confidence> </Location> <Location> <Name>the south (on I-405 N)</Name> <Point> <Latitude>47.615979909896851</Latitude> <Longitude>-122.18860030174255</Longitude> </Point> <Confidence>High</Confidence> </Location> <Location> <Name>the east (on SR-520 W)</Name> <Point> <Latitude>47.671131491661072</Latitude> <Longitude>-122.10670173168182</Longitude> </Point> <Confidence>High</Confidence> </Location> <Location> <Name>the west (on SR-520 E)</Name> <Point> <Latitude>47.636691927909851</Latitude> <Longitude>-122.19275772571564</Longitude> </Point> <Confidence>High</Confidence> </Location> </Resources> </ResourceSet> </ResourceSets> 300

</Response>

JSON Response You would receive the following JSON response if the output=xml parameter was not set in this example.
{ "authenticationResultCode":"ValidCredentials", "brandLogoUri":"http:\/\/dev.virtualearth.net\/Branding\/logo_powered_by.png", "copyright":"Copyright 2010 Microsoft and its suppliers. All rights reserved. This A PI cannot be accessed and the content and any results may not be used, reproduced or tran smitted in any manner without express written permission from Microsoft Corporation.", "resourceSets":[ { "estimatedTotal":4, "resources":[ { "__type":"Location:http:\/\/schemas.microsoft.com\/search\/local\/ws\/rest \/v1", "name":"the north (on I-405 S)", "point":{ "type":"Point", "coordinates":[ 47.684789299964905, -122.18332171440125 ] }, "confidence":"High", "entityType":null }, { "__type":"Location:http:\/\/schemas.microsoft.com\/search\/local\/ws\/rest \/v1", "name":"the south (on I-405 N)", "point":{ "type":"Point", 301

"coordinates":[ 47.615979909896851, -122.18860030174255 ] }, "confidence":"High", "entityType":null }, { "__type":"Location:http:\/\/schemas.microsoft.com\/search\/local\/ws\/rest \/v1", "name":"the east (on SR-520 W)", "point":{ "type":"Point", "coordinates":[ 47.671131491661072, -122.10670173168182 ] }, "confidence":"High", "entityType":null }, { "__type":"Location:http:\/\/schemas.microsoft.com\/search\/local\/ws\/rest \/v1", "name":"the west (on SR-520 E)", "point":{ "type":"Point", "coordinates":[ 47.636691927909851, -122.19275772571564 ] }, "confidence":"High", 302

"entityType":null } ] } ], "statusCode":200, "statusDescription":"OK", "traceId":"e2bbc0171d224d85bbf5f41a91233b72" }

Find driving routes from major roads. This example returns routes to Spokane, Washington from major roads.
http://dev.virtualearth.net/REST/V1/Routes/FromMajorRoads?dest=Spokane%20WA&output=xml&ke y=BingMapsKey

XML response The response for this example contains a set of Route resources that provide directions for routes to Spokane, Washington from major roads.
<Response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/search/local/ws/rest/v1"> <Copyright>Copyright 2010 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.</Copyright> <BrandLogoUri>http://veintplat3.liveint.com/Branding/logo_powered_by.png</BrandLogoUri> <StatusCode>200</StatusCode> <StatusDescription>OK</StatusDescription> <AuthenticationResultCode>ValidCredentials</AuthenticationResultCode> <TraceId>b081f10cb6194b54865e9eace7789385|BR1M006800</TraceId> <ResourceSets> <ResourceSet> <EstimatedTotal>4</EstimatedTotal> <Resources> <Route>

303

<Id>v60,i0,a0,cenUS,dAAAAAAAAAAA=,y0,s1,m0,o0,t0,woGQ8BOjrkPU=~kmIi/8mBtAAAAA4BAAAAAAA=~dGhlIGVhc3QgKG9uIE ktOTAgVyk=~~~,wqXc8BOY3kPU=~kmIi/8ntswAAAA4BjKv/PgA=~U3Bva2FuZSwgV0E=~0~~,k1</Id> <BoundingBox> <SouthLatitude>47.65221118927002</SouthLatitude> <WestLongitude>-117.41227939724922</WestLongitude> <NorthLatitude>47.657259106636047</NorthLatitude> <EastLongitude>-117.38137900829315</EastLongitude> </BoundingBox> <DistanceUnit>Kilometer</DistanceUnit> <DurationUnit>Second</DurationUnit> <TravelDistance>2.844</TravelDistance> <TravelDuration>214</TravelDuration> <RouteLeg> <TravelDistance>2.844</TravelDistance> <TravelDuration>214</TravelDuration> <ActualStart> <Latitude>47.653992176055908</Latitude> <Longitude>-117.38137900829315</Longitude> </ActualStart> <ActualEnd> <Latitude>47.657259106636047</Latitude> <Longitude>-117.41227939724922</Longitude> </ActualEnd> <StartLocation> <Name>the east (on I-90 W)</Name> <Point> <Latitude>47.653992176055908</Latitude> <Longitude>-117.38137900829315</Longitude> </Point> <Confidence>High</Confidence> </StartLocation> <EndLocation> <Name>Spokane, WA</Name> 304

<Point> <Latitude>47.6572597771883</Latitude> <Longitude>-117.41227939724922</Longitude> </Point> <Confidence>High</Confidence> </EndLocation> <ItineraryItem> <TravelMode>Driving</TravelMode> <TravelDistance>1.866</TravelDistance> <TravelDuration>67</TravelDuration> <ManeuverPoint> <Latitude>47.653992176055908</Latitude> <Longitude>-117.38137900829315</Longitude> </ManeuverPoint> <Instruction maneuverType="DepartStart">Depart I-90 West</Instruction> <CompassDirection>west</CompassDirection> </ItineraryItem> <ItineraryItem> <TravelMode>Driving</TravelMode> <TravelDistance>0.482</TravelDistance> <TravelDuration>66</TravelDuration> <ManeuverPoint> <Latitude>47.652361392974854</Latitude> <Longitude>-117.40572810173035</Longitude> </ManeuverPoint> <Instruction maneuverType="TakeRampRight">At exit 281, take ramp right for US-395 North / US-2 North toward Newport / Colville</Instruction> <CompassDirection>west</CompassDirection> </ItineraryItem> <ItineraryItem> <TravelMode>Driving</TravelMode> <TravelDistance>0.418</TravelDistance> <TravelDuration>57</TravelDuration> <ManeuverPoint> 305

<Latitude>47.653520107269287</Latitude> <Longitude>-117.41123735904694</Longitude> </ManeuverPoint> <Instruction maneuverType="BearRight">Bear right onto US-2 East / US-395 North / S Division St</Instruction> <CompassDirection>north</CompassDirection> </ItineraryItem> <ItineraryItem> <TravelMode>Driving</TravelMode> <TravelDistance>0.078</TravelDistance> <TravelDuration>22</TravelDuration> <ManeuverPoint> <Latitude>47.657259106636047</Latitude> <Longitude>-117.41123735904694</Longitude> </ManeuverPoint> <Instruction maneuverType="TurnLeft">Turn left onto W Sprague Ave</Instruction> <CompassDirection>west</CompassDirection> </ItineraryItem> <ItineraryItem> <TravelMode>Driving</TravelMode> <TravelDistance>0</TravelDistance> <TravelDuration>0</TravelDuration> <ManeuverPoint> <Latitude>47.657259106636047</Latitude> <Longitude>-117.41227939724922</Longitude> </ManeuverPoint> <Instruction maneuverType="ArriveFinish">Arrive at Spokane, WA</Instruction> <CompassDirection>west</CompassDirection> <Hint hintType="PreviousIntersection">The last intersection is US-2 North / US-395 East / N Division St</Hint> <Hint hintType="NextIntersection">If you reach US-2 South / US-395 West / N Browne St, you've gone too far</Hint> </ItineraryItem> 306

</RouteLeg> </Route> <Route> <Id>v60,i0,a0,cenUS,dAAAAAAAAAAA=,y0,s1,m0,o0,t0,wqNg8BHg+kPU=~kmIi/zEItAAAAA4BAAAAAAA=~dGhlIG5vcnRoIChvbi BVUy0yIFcgLyBVUy0zOTUgUyAvIE4gRGl2aXNpb24gU3Qp~~~,wqXc8BOY3kPU=~kmIi/8ntswAAAA4BjKv/PgA=~ U3Bva2FuZSwgV0E=~0~~,k1</Id> <BoundingBox> <SouthLatitude>47.657259106636047</SouthLatitude> <WestLongitude>-117.41332948207855</WestLongitude> <NorthLatitude>47.6739102602005</NorthLatitude> <EastLongitude>-117.41115152835846</EastLongitude> </BoundingBox> <DistanceUnit>Kilometer</DistanceUnit> <DurationUnit>Second</DurationUnit> <TravelDistance>2.032</TravelDistance> <TravelDuration>199</TravelDuration> <RouteLeg> <TravelDistance>2.032</TravelDistance> <TravelDuration>199</TravelDuration> <ActualStart> <Latitude>47.6739102602005</Latitude> <Longitude>-117.41115152835846</Longitude> </ActualStart> <ActualEnd> <Latitude>47.657259106636047</Latitude> <Longitude>-117.41227939724922</Longitude> </ActualEnd> <StartLocation> <Name>the north (on US-2 W / US-395 S / N Division St)</Name> <Point> <Latitude>47.6739102602005</Latitude> <Longitude>-117.41115152835846</Longitude> </Point>

307

<Confidence>High</Confidence> </StartLocation> <EndLocation> <Name>Spokane, WA</Name> <Point> <Latitude>47.6572597771883</Latitude> <Longitude>-117.41227939724922</Longitude> </Point> <Confidence>High</Confidence> </EndLocation> <ItineraryItem> <TravelMode>Driving</TravelMode> <TravelDistance>1.954</TravelDistance> <TravelDuration>176</TravelDuration> <ManeuverPoint> <Latitude>47.6739102602005</Latitude> <Longitude>-117.41115152835846</Longitude> </ManeuverPoint> <Instruction maneuverType="DepartStart">Depart US-2 West / US-395 South / N Division St toward W Augusta Ave</Instruction> <CompassDirection>south</CompassDirection> </ItineraryItem> <ItineraryItem> <TravelMode>Driving</TravelMode> <TravelDistance>0.078</TravelDistance> <TravelDuration>22</TravelDuration> <ManeuverPoint> <Latitude>47.657259106636047</Latitude> <Longitude>-117.41331875324249</Longitude> </ManeuverPoint> <Instruction maneuverType="TurnLeft">Turn left onto W Sprague Ave</Instruction> <CompassDirection>east</CompassDirection> </ItineraryItem> 308

<ItineraryItem> <TravelMode>Driving</TravelMode> <TravelDistance>0</TravelDistance> <TravelDuration>0</TravelDuration> <ManeuverPoint> <Latitude>47.657259106636047</Latitude> <Longitude>-117.41227939724922</Longitude> </ManeuverPoint> <Instruction maneuverType="ArriveFinish">Arrive at Spokane, WA</Instruction> <CompassDirection>east</CompassDirection> <Hint hintType="PreviousIntersection">The last intersection is US-2 South / US-395 West / N Browne St</Hint> <Hint hintType="NextIntersection">If you reach US-2 North / US-395 East / N Division St, you've gone too far</Hint> </ItineraryItem> </RouteLeg> </Route> <Route> <Id>v60,i0,a0,cenUS,dAAAAAAAAAAA=,y0,s1,m0,o0,t0,wCLc7BHCbj/U=~kmIi/8k0swAAAA4BAAAAAAA=~dGhlIHNvdXRoIChvbi BVUy0xOTUgTik=~~~,wqXc8BOY3kPU=~kmIi/8ntswAAAA4BjKv/PgA=~U3Bva2FuZSwgV0E=~0~~,k1</Id> <BoundingBox> <SouthLatitude>47.624192833900452</SouthLatitude> <WestLongitude>-117.4500972032547</WestLongitude> <NorthLatitude>47.657259106636047</NorthLatitude> <EastLongitude>-117.41123735904694</EastLongitude> </BoundingBox> <DistanceUnit>Kilometer</DistanceUnit> <DurationUnit>Second</DurationUnit> <TravelDistance>6.357</TravelDistance> <TravelDuration>352</TravelDuration> <RouteLeg> <TravelDistance>6.357</TravelDistance> <TravelDuration>352</TravelDuration> 309

<ActualStart> <Latitude>47.624192833900452</Latitude> <Longitude>-117.43913769721985</Longitude> </ActualStart> <ActualEnd> <Latitude>47.657259106636047</Latitude> <Longitude>-117.41227939724922</Longitude> </ActualEnd> <StartLocation> <Name>the south (on US-195 N)</Name> <Point> <Latitude>47.624192833900452</Latitude> <Longitude>-117.43913769721985</Longitude> </Point> <Confidence>High</Confidence> </StartLocation> <EndLocation> <Name>Spokane, WA</Name> <Point> <Latitude>47.6572597771883</Latitude> <Longitude>-117.41227939724922</Longitude> </Point> <Confidence>High</Confidence> </EndLocation> <ItineraryItem> <TravelMode>Driving</TravelMode> <TravelDistance>2.366</TravelDistance> <TravelDuration>92</TravelDuration> <ManeuverPoint> <Latitude>47.624192833900452</Latitude> <Longitude>-117.43913769721985</Longitude> </ManeuverPoint> <Instruction maneuverType="DepartStart">Depart US-195 North toward W Thorpe Rd</Instruction> 310

<CompassDirection>northwest</CompassDirection> </ItineraryItem> <ItineraryItem> <TravelMode>Driving</TravelMode> <TravelDistance>2.88</TravelDistance> <TravelDuration>126</TravelDuration> <ManeuverPoint> <Latitude>47.644169926643372</Latitude> <Longitude>-117.44960904121399</Longitude> </ManeuverPoint> <Instruction maneuverType="RampThenHighwayRight">Take ramp right for I-90 East / US-2 North / US-395 East toward Spokane</Instruction> <CompassDirection>north</CompassDirection> </ItineraryItem> <ItineraryItem> <TravelMode>Driving</TravelMode> <TravelDistance>0.457</TravelDistance> <TravelDuration>24</TravelDuration> <ManeuverPoint> <Latitude>47.652651071548462</Latitude> <Longitude>-117.41769075393677</Longitude> </ManeuverPoint> <Instruction maneuverType="TakeRampRight">At exit 281, take ramp right for Division St / US-2 East / US-395 North toward Newport / Colville</Instruction> <CompassDirection>east</CompassDirection> </ItineraryItem> <ItineraryItem> <TravelMode>Driving</TravelMode> <TravelDistance>0.57600000000000007</TravelDistance> <TravelDuration>86</TravelDuration> <ManeuverPoint> <Latitude>47.652232646942139</Latitude> <Longitude>-117.41167724132538</Longitude> </ManeuverPoint> 311

<Instruction maneuverType="TurnLeft">Turn left onto US-2 East / US-395 North / S Division St</Instruction> <CompassDirection>north</CompassDirection> </ItineraryItem> <ItineraryItem> <TravelMode>Driving</TravelMode> <TravelDistance>0.078</TravelDistance> <TravelDuration>22</TravelDuration> <ManeuverPoint> <Latitude>47.657259106636047</Latitude> <Longitude>-117.41123735904694</Longitude> </ManeuverPoint> <Instruction maneuverType="TurnLeft">Turn left onto W Sprague Ave</Instruction> <CompassDirection>west</CompassDirection> </ItineraryItem> <ItineraryItem> <TravelMode>Driving</TravelMode> <TravelDistance>0</TravelDistance> <TravelDuration>0</TravelDuration> <ManeuverPoint> <Latitude>47.657259106636047</Latitude> <Longitude>-117.41227939724922</Longitude> </ManeuverPoint> <Instruction maneuverType="ArriveFinish">Arrive at Spokane, WA</Instruction> <CompassDirection>west</CompassDirection> <Hint hintType="PreviousIntersection">The last intersection is US-2 North / US-395 East / N Division St</Hint> <Hint hintType="NextIntersection">If you reach US-2 South / US-395 West / N Browne St, you've gone too far</Hint> </ItineraryItem> </RouteLeg> </Route> <Route> 312

<Id>v60,i0,a0,cenUS,dAAAAAAAAAAA=,y0,s1,m0,o0,t0,wqBg8BIBJjvU=~kmIi/7masgAAAA4BAAAAAAA=~dGhlIHdlc3QgKG9uIF VTLTIgRSk=~~~,wqXc8BOY3kPU=~kmIi/8ntswAAAA4BjKv/PgA=~U3Bva2FuZSwgV0E=~0~~,k1</Id> <BoundingBox> <SouthLatitude>47.632818818092346</SouthLatitude> <WestLongitude>-117.49714851379395</WestLongitude> <NorthLatitude>47.657259106636047</NorthLatitude> <EastLongitude>-117.41123735904694</EastLongitude> </BoundingBox> <DistanceUnit>Kilometer</DistanceUnit> <DurationUnit>Second</DurationUnit> <TravelDistance>8.071</TravelDistance> <TravelDuration>406</TravelDuration> <RouteLeg> <TravelDistance>8.071</TravelDistance> <TravelDuration>406</TravelDuration> <ActualStart> <Latitude>47.6409512758255</Latitude> <Longitude>-117.49714851379395</Longitude> </ActualStart> <ActualEnd> <Latitude>47.657259106636047</Latitude> <Longitude>-117.41227939724922</Longitude> </ActualEnd> <StartLocation> <Name>the west (on US-2 E)</Name> <Point> <Latitude>47.6409512758255</Latitude> <Longitude>-117.49714851379395</Longitude> </Point> <Confidence>High</Confidence> </StartLocation> <EndLocation> <Name>Spokane, WA</Name> 313

<Point> <Latitude>47.6572597771883</Latitude> <Longitude>-117.41227939724922</Longitude> </Point> <Confidence>High</Confidence> </EndLocation> <ItineraryItem> <TravelMode>Driving</TravelMode> <TravelDistance>1.183</TravelDistance> <TravelDuration>43</TravelDuration> <ManeuverPoint> <Latitude>47.6409512758255</Latitude> <Longitude>-117.49714851379395</Longitude> </ManeuverPoint> <Instruction maneuverType="DepartStart">Depart US-2 East</Instruction> <CompassDirection>southeast</CompassDirection> </ItineraryItem> <ItineraryItem> <TravelMode>Driving</TravelMode> <TravelDistance>5.777</TravelDistance> <TravelDuration>229</TravelDuration> <ManeuverPoint> <Latitude>47.635141611099243</Latitude> <Longitude>-117.48395204544067</Longitude> </ManeuverPoint> <Instruction maneuverType="RampThenHighwayLeft">Take ramp left for I-90 East / US-2 North / US-395 East toward Spokane</Instruction> <CompassDirection>southeast</CompassDirection> </ItineraryItem> <ItineraryItem> <TravelMode>Driving</TravelMode> <TravelDistance>0.457</TravelDistance> <TravelDuration>24</TravelDuration> <ManeuverPoint> 314

<Latitude>47.652651071548462</Latitude> <Longitude>-117.41769075393677</Longitude> </ManeuverPoint> <Instruction maneuverType="TakeRampRight">At exit 281, take ramp right for Division St / US-2 East / US-395 North toward Newport / Colville</Instruction> <CompassDirection>east</CompassDirection> </ItineraryItem> <ItineraryItem> <TravelMode>Driving</TravelMode> <TravelDistance>0.57600000000000007</TravelDistance> <TravelDuration>86</TravelDuration> <ManeuverPoint> <Latitude>47.652232646942139</Latitude> <Longitude>-117.41167724132538</Longitude> </ManeuverPoint> <Instruction maneuverType="TurnLeft">Turn left onto US-2 East / US-395 North / S Division St</Instruction> <CompassDirection>north</CompassDirection> </ItineraryItem> <ItineraryItem> <TravelMode>Driving</TravelMode> <TravelDistance>0.078</TravelDistance> <TravelDuration>22</TravelDuration> <ManeuverPoint> <Latitude>47.657259106636047</Latitude> <Longitude>-117.41123735904694</Longitude> </ManeuverPoint> <Instruction maneuverType="TurnLeft">Turn left onto W Sprague Ave</Instruction> <CompassDirection>west</CompassDirection> </ItineraryItem> <ItineraryItem> <TravelMode>Driving</TravelMode> <TravelDistance>0</TravelDistance>

315

<TravelDuration>0</TravelDuration> <ManeuverPoint> <Latitude>47.657259106636047</Latitude> <Longitude>-117.41227939724922</Longitude> </ManeuverPoint> <Instruction maneuverType="ArriveFinish">Arrive at Spokane, WA</Instruction> <CompassDirection>west</CompassDirection> <Hint hintType="PreviousIntersection">The last intersection is US-2 North / US-395 East / N Division St</Hint> <Hint hintType="NextIntersection">If you reach US-2 South / US-395 West / N Browne St, you've gone too far</Hint> </ItineraryItem> </RouteLeg> </Route> </Resources> </ResourceSet> </ResourceSets> </Response>

JSON Response You would receive the following JSON response if the output=xml parameter was not set in this example.
{ "authenticationResultCode":"ValidCredentials", "brandLogoUri":"http:\/\/veintplat3.live-int.com\/Branding\/logo_powered_by.png", "copyright":"Copyright 2010 Microsoft and its suppliers. All rights reserved. This A PI cannot be accessed and the content and any results may not be used, reproduced or tran smitted in any manner without express written permission from Microsoft Corporation.", "resourceSets":[ { "estimatedTotal":4, "resources":[ {

316

"__type":"Route:http:\/\/schemas.microsoft.com\/search\/local\/ws\/rest\/v 1", "bbox":[ 47.624192833900452, -117.4500972032547, 47.657259106636047, -117.41123735904694 ], "id":"v60,i0,a0,cenUS,dAAAAAAAAAAA=,y0,s1,m0,o0,t0,wCLc7BHCbj\/U=~kmIi\/8k0swAAAA4BAAAAAAA=~dGhlIHNvdXRoIChv biBVUy0xOTUgTik=~~~,wqXc8BOc3kPU=~kmIi\/8ntswAAAA4BkMT\/PgA=~U3Bva2FuZSwgV0E=~0~~,k1", "distanceUnit":"Kilometer", "durationUnit":"Second", "routeLegs":[ { "actualEnd":{ "type":"Point", "coordinates":[ 47.657259106636047, -117.41227872669697 ] }, "actualStart":{ "type":"Point", "coordinates":[ 47.624192833900452, -117.43913769721985 ] }, "endLocation":{ "name":"Spokane, WA", "point":{ "type":"Point", "coordinates":[

317

47.65726, -117.412279 ] }, "confidence":"High", "entityType":null }, "itineraryItems":[ { "compassDirection":"northwest", "instruction":{ "maneuverType":"DepartStart", "text":"Depart US-195 North toward W Thorpe Rd" }, "maneuverPoint":{ "type":"Point", "coordinates":[ 47.624192833900452, -117.43913769721985 ] }, "travelDistance":2.366, "travelDuration":92, "travelMode":"Driving" }, { "compassDirection":"north", "instruction":{ "maneuverType":"RampThenHighwayRight", "text":"Take ramp right for I-90 East \/ US-2 North \/ US395 East toward Spokane" }, "maneuverPoint":{ "type":"Point", 318

"coordinates":[ 47.644169926643372, -117.44960904121399 ] }, "travelDistance":2.88, "travelDuration":126, "travelMode":"Driving" }, { "compassDirection":"east", "instruction":{ "maneuverType":"TakeRampRight", "text":"At exit 281, take ramp right for Division St \/ US2 East \/ US-395 North toward Newport \/ Colville" }, "maneuverPoint":{ "type":"Point", "coordinates":[ 47.652651071548462, -117.41769075393677 ] }, "travelDistance":0.457, "travelDuration":24, "travelMode":"Driving" }, { "compassDirection":"north", "instruction":{ "maneuverType":"TurnLeft", "text":"Turn left onto US-2 East \/ US395 North \/ S Division St" }, 319

"maneuverPoint":{ "type":"Point", "coordinates":[ 47.652232646942139, -117.41167724132538 ] }, "travelDistance":0.57600000000000007, "travelDuration":86, "travelMode":"Driving" }, { "compassDirection":"west", "instruction":{ "maneuverType":"TurnLeft", "text":"Turn left onto W Sprague Ave" }, "maneuverPoint":{ "type":"Point", "coordinates":[ 47.657259106636047, -117.41123735904694 ] }, "travelDistance":0.078, "travelDuration":22, "travelMode":"Driving" }, { "compassDirection":"west", "hints":[ { "hintType":"PreviousIntersection",

320

"text":"The last intersection is US-2 North \/ US395 East \/ N Division St" }, { "hintType":"NextIntersection", "text":"If you reach US-2 South \/ US395 West \/ N Browne St, you've gone too far" } ], "instruction":{ "maneuverType":"ArriveFinish", "text":"Arrive at Spokane, WA" }, "maneuverPoint":{ "type":"Point", "coordinates":[ 47.657259106636047, -117.41227872669697 ] }, "travelDistance":0, "travelDuration":0, "travelMode":"Driving" } ], "startLocation":{ "name":"the south (on US-195 N)", "point":{ "type":"Point", "coordinates":[ 47.624192833900452, -117.43913769721985 ] }, 321

"confidence":"High", "entityType":null }, "travelDistance":6.357, "travelDuration":352 } ], "travelDistance":6.357, "travelDuration":352 }, { "__type":"Route:http:\/\/schemas.microsoft.com\/search\/local\/ws\/rest\/v 1", "bbox":[ 47.657259106636047, -117.41332948207855, 47.6739102602005, -117.41115152835846 ], "id":"v60,i0,a0,cenUS,dAAAAAAAAAAA=,y0,s1,m0,o0,t0,wqNg8BHg+kPU=~kmIi\/zEItAAAAA4BAAAAAAA=~dGhlIG5vcnRoIChvb iBVUy0yIFcgLyBVUy0zOTUgUyAvIE4gRGl2aXNpb24gU3Qp~~~,wqXc8BOc3kPU=~kmIi\/8ntswAAAA4BkMT\/Pg A=~U3Bva2FuZSwgV0E=~0~~,k1", "distanceUnit":"Kilometer", "durationUnit":"Second", "routeLegs":[ { "actualEnd":{ "type":"Point", "coordinates":[ 47.657259106636047, -117.41227872669697 ] },

322

"actualStart":{ "type":"Point", "coordinates":[ 47.6739102602005, -117.41115152835846 ] }, "endLocation":{ "name":"Spokane, WA", "point":{ "type":"Point", "coordinates":[ 47.65726, -117.412279 ] }, "confidence":"High", "entityType":null }, "itineraryItems":[ { "compassDirection":"south", "instruction":{ "maneuverType":"DepartStart", "text":"Depart US-2 West \/ US395 South \/ N Division St toward W Augusta Ave" }, "maneuverPoint":{ "type":"Point", "coordinates":[ 47.6739102602005, -117.41115152835846 ] }, 323

"travelDistance":1.954, "travelDuration":176, "travelMode":"Driving" }, { "compassDirection":"east", "instruction":{ "maneuverType":"TurnLeft", "text":"Turn left onto W Sprague Ave" }, "maneuverPoint":{ "type":"Point", "coordinates":[ 47.657259106636047, -117.41331875324249 ] }, "travelDistance":0.078, "travelDuration":22, "travelMode":"Driving" }, { "compassDirection":"east", "hints":[ { "hintType":"PreviousIntersection", "text":"The last intersection is US-2 South \/ US395 West \/ N Browne St" }, { "hintType":"NextIntersection", "text":"If you reach US-2 North \/ US395 East \/ N Division St, you've gone too far" } 324

], "instruction":{ "maneuverType":"ArriveFinish", "text":"Arrive at Spokane, WA" }, "maneuverPoint":{ "type":"Point", "coordinates":[ 47.657259106636047, -117.41227872669697 ] }, "travelDistance":0, "travelDuration":0, "travelMode":"Driving" } ], "startLocation":{ "name":"the north (on US-2 W \/ US-395 S \/ N Division St)", "point":{ "type":"Point", "coordinates":[ 47.6739102602005, -117.41115152835846 ] }, "confidence":"High", "entityType":null }, "travelDistance":2.032, "travelDuration":199 } ], "travelDistance":2.032, 325

"travelDuration":199 }, { "__type":"Route:http:\/\/schemas.microsoft.com\/search\/local\/ws\/rest\/v 1", "bbox":[ 47.632818818092346, -117.49714851379395, 47.657259106636047, -117.41123735904694 ], "id":"v60,i0,a0,cenUS,dAAAAAAAAAAA=,y0,s1,m0,o0,t0,wqBg8BIBJjvU=~kmIi\/7masgAAAA4BAAAAAAA=~dGhlIHdlc3QgKG9uI FVTLTIgRSk=~~~,wqXc8BOc3kPU=~kmIi\/8ntswAAAA4BkMT\/PgA=~U3Bva2FuZSwgV0E=~0~~,k1", "distanceUnit":"Kilometer", "durationUnit":"Second", "routeLegs":[ { "actualEnd":{ "type":"Point", "coordinates":[ 47.657259106636047, -117.41227872669697 ] }, "actualStart":{ "type":"Point", "coordinates":[ 47.6409512758255, -117.49714851379395 ] }, "endLocation":{ "name":"Spokane, WA",

326

"point":{ "type":"Point", "coordinates":[ 47.65726, -117.412279 ] }, "confidence":"High", "entityType":null }, "itineraryItems":[ { "compassDirection":"southeast", "instruction":{ "maneuverType":"DepartStart", "text":"Depart US-2 East" }, "maneuverPoint":{ "type":"Point", "coordinates":[ 47.6409512758255, -117.49714851379395 ] }, "travelDistance":1.183, "travelDuration":43, "travelMode":"Driving" }, { "compassDirection":"southeast", "instruction":{ "maneuverType":"RampThenHighwayLeft", "text":"Take ramp left for I-90 East \/ US-2 North \/ US395 East toward Spokane" 327

}, "maneuverPoint":{ "type":"Point", "coordinates":[ 47.635141611099243, -117.48395204544067 ] }, "travelDistance":5.777, "travelDuration":229, "travelMode":"Driving" }, { "compassDirection":"east", "instruction":{ "maneuverType":"TakeRampRight", "text":"At exit 281, take ramp right for Division St \/ US2 East \/ US-395 North toward Newport \/ Colville" }, "maneuverPoint":{ "type":"Point", "coordinates":[ 47.652651071548462, -117.41769075393677 ] }, "travelDistance":0.457, "travelDuration":24, "travelMode":"Driving" }, { "compassDirection":"north", "instruction":{ "maneuverType":"TurnLeft", 328

"text":"Turn left onto US-2 East \/ US395 North \/ S Division St" }, "maneuverPoint":{ "type":"Point", "coordinates":[ 47.652232646942139, -117.41167724132538 ] }, "travelDistance":0.57600000000000007, "travelDuration":86, "travelMode":"Driving" }, { "compassDirection":"west", "instruction":{ "maneuverType":"TurnLeft", "text":"Turn left onto W Sprague Ave" }, "maneuverPoint":{ "type":"Point", "coordinates":[ 47.657259106636047, -117.41123735904694 ] }, "travelDistance":0.078, "travelDuration":22, "travelMode":"Driving" }, { "compassDirection":"west", "hints":[ 329

{ "hintType":"PreviousIntersection", "text":"The last intersection is US-2 North \/ US395 East \/ N Division St" }, { "hintType":"NextIntersection", "text":"If you reach US-2 South \/ US395 West \/ N Browne St, you've gone too far" } ], "instruction":{ "maneuverType":"ArriveFinish", "text":"Arrive at Spokane, WA" }, "maneuverPoint":{ "type":"Point", "coordinates":[ 47.657259106636047, -117.41227872669697 ] }, "travelDistance":0, "travelDuration":0, "travelMode":"Driving" } ], "startLocation":{ "name":"the west (on US-2 E)", "point":{ "type":"Point", "coordinates":[ 47.6409512758255, -117.49714851379395 330

] }, "confidence":"High", "entityType":null }, "travelDistance":8.071, "travelDuration":406 } ], "travelDistance":8.071, "travelDuration":406 }, { "__type":"Route:http:\/\/schemas.microsoft.com\/search\/local\/ws\/rest\/v 1", "bbox":[ 47.65221118927002, -117.41227872669697, 47.657259106636047, -117.38137900829315 ], "id":"v60,i0,a0,cenUS,dAAAAAAAAAAA=,y0,s1,m0,o0,t0,woGQ8BOjrkPU=~kmIi\/8mBtAAAAA4BAAAAAAA=~dGhlIGVhc3QgKG9uI EktOTAgVyk=~~~,wqXc8BOc3kPU=~kmIi\/8ntswAAAA4BkMT\/PgA=~U3Bva2FuZSwgV0E=~0~~,k1", "distanceUnit":"Kilometer", "durationUnit":"Second", "routeLegs":[ { "actualEnd":{ "type":"Point", "coordinates":[ 47.657259106636047, -117.41227872669697 ]

331

}, "actualStart":{ "type":"Point", "coordinates":[ 47.653992176055908, -117.38137900829315 ] }, "endLocation":{ "name":"Spokane, WA", "point":{ "type":"Point", "coordinates":[ 47.65726, -117.412279 ] }, "confidence":"High", "entityType":null }, "itineraryItems":[ { "compassDirection":"west", "instruction":{ "maneuverType":"DepartStart", "text":"Depart I-90 West" }, "maneuverPoint":{ "type":"Point", "coordinates":[ 47.653992176055908, -117.38137900829315 ] }, 332

"travelDistance":1.866, "travelDuration":67, "travelMode":"Driving" }, { "compassDirection":"west", "instruction":{ "maneuverType":"TakeRampRight", "text":"At exit 281, take ramp right for US395 North \/ US-2 North toward Newport \/ Colville" }, "maneuverPoint":{ "type":"Point", "coordinates":[ 47.652361392974854, -117.40572810173035 ] }, "travelDistance":0.482, "travelDuration":66, "travelMode":"Driving" }, { "compassDirection":"north", "instruction":{ "maneuverType":"BearRight", "text":"Bear right onto US-2 East \/ US395 North \/ S Division St" }, "maneuverPoint":{ "type":"Point", "coordinates":[ 47.653520107269287, -117.41123735904694 333

] }, "travelDistance":0.418, "travelDuration":57, "travelMode":"Driving" }, { "compassDirection":"west", "instruction":{ "maneuverType":"TurnLeft", "text":"Turn left onto W Sprague Ave" }, "maneuverPoint":{ "type":"Point", "coordinates":[ 47.657259106636047, -117.41123735904694 ] }, "travelDistance":0.078, "travelDuration":22, "travelMode":"Driving" }, { "compassDirection":"west", "hints":[ { "hintType":"PreviousIntersection", "text":"The last intersection is US-2 North \/ US395 East \/ N Division St" }, { "hintType":"NextIntersection",

334

"text":"If you reach US-2 South \/ US395 West \/ N Browne St, you've gone too far" } ], "instruction":{ "maneuverType":"ArriveFinish", "text":"Arrive at Spokane, WA" }, "maneuverPoint":{ "type":"Point", "coordinates":[ 47.657259106636047, -117.41227872669697 ] }, "travelDistance":0, "travelDuration":0, "travelMode":"Driving" } ], "startLocation":{ "name":"the east (on I-90 W)", "point":{ "type":"Point", "coordinates":[ 47.653992176055908, -117.38137900829315 ] }, "confidence":"High", "entityType":null }, "travelDistance":2.844, "travelDuration":214 335

} ], "travelDistance":2.844, "travelDuration":214 } ] } ], "statusCode":200, "statusDescription":"OK", "traceId":"84c3d8e2626340e99a02f6e1c0c06543" }

HTTP Status Codes


For more details about these HTTP status codes, see Status Codes and Error Handling. When the request is successful, the following HTTP status code is returned. 200 400 401 404 500 503 When the request is not successful, the response returns one of the following errors.

Route Data
The response returned by a Routes URL contains a Route resource. The information provided in the Route resource includes the route distance, the travel time, and the itinerary details for each route leg. A route leg is a section of the route defined by two waypoints, and it provides a set of route steps to follow. A route step includes instructions, as well as further details (warnings and hints) about the route, when available. When a route path is requested by setting the routePathOutput parameter in the request, the Route resource also provides a set of Point (latitude and longitude) values for each route leg. The following tables provide the descriptions of the Route resource fields, followed by XML and JSON examples. For more information about the common response container for the Bing Maps REST Services, see Common Response Description.

336

Route Resource
The following tables describe the fields in the Route resource in a hierarchical manner. Top-level Route Resource Fields The following fields are the top-level fields in the Routes resource. Additional tables describe the fields in each of the collections.
JSON XML Type Description

id bbox

Id BoundingBox

string BoundingBox. For more information about the BoundingBox type, see Location and Area Types.

A unique ID for the resource. Defines a rectangular area by using latitude and longitude boundaries that contain the corresponding route or location. A bounding box contains SouthLatitude, WestLongitude, NorthLatitude, and EastLongitude elements. The unit used for distance. The unit used for time of travel. The physical distance covered by the entire route.

distanceUnit durationUnit travelDistance

DistanceUnit DurationUnit TravelDistance

string string double

This value is not supported for the Transit travel mode. travelDuration TravelDuration double The time in seconds that it takes to travel a corresponding TravelDistance. Information about a section of a route
337

routeLegs

RouteLeg

collection

JSON

XML

Type

Description

between two waypoints. For more information about the fields contained ina routeLeg, see the Route Leg Fields section below. routePath RoutePath collection A representation of the path of a route. A RoutePath is returned only if the routePathOutput parameter is set to Points. A RoutePath is defined by a Line element that contains of a collection of points. The path of the route is the line that connects these Points. For more information about the fields contained in a route Path, see the Route Path Fields section below.

Route Leg Fields These fields are specific to the RouteLeg collection in the Route resource.
JSON XML Type Description

travelDistance travelDuration

TravelDistance TravelDuration

double double

The physical distance covered by a route leg. The time, in seconds, that it takes to travel a corresponding TravelDistance. The Point (latitude and longitude) that was
338

actualStart

ActualStart

Point. For more information about

JSON

XML

Type

Description

the Point type, see Location and Area Types.

used as the actual starting location for the route leg. In most cases, the ActualStart is the same as the requested waypoint. However, if a waypoint is not close to a road, the Routes API chooses a location on the nearest road as the starting point of the route. This ActualStart element contains the latitude and longitude of this new location. The Point (latitude and longitude) that was used as the actual ending location for the route leg. In most cases, the ActualEnd is the same as the requested waypoint. However, if a waypoint is not close to a road, the Routes API chooses a location on the nearest road as the ending point of the route. This ActualEnd element contains the latitude and longitude of this new location. Information about the location of the starting waypoint for a route. A StartLocation is provided only when the waypoint is specified as a landmark or an
339

actualEnd

ActualEnd

Point. For more information about the Point type, see Location and Area Types.

startLocation

StartLocation

collection

JSON

XML

Type

Description

address. For more information about the fields contained in a Location collection, see the Location Fields table below. endLocation EndLocation collection Information about the location of the ending waypoint for a route. An EndLocation is provided only when the waypoint is specified as a landmark or an address. For more information about the fields contained in a Location collection, see the Locations Fields table below. Information that defines a step in the route. For information about the fields that make up the ItineraryItem collection, see the Itinerary Item Fields table below.

itineraryItem

ItineraryItem

collection

Location Fields These fields are found in the StartLocation and EndLocation collections.
JSON XML Type Description

name

Name

string

The name of a location, such as San Francisco, CA. The coordinates of a point on the Earth. A point contains Latitude
340

point

Point

Point. For more information about the Point type, see

JSON

XML

Type

Description

Location and Area Types.

and Longitude elements. This point is also included in the geocode points collection. A collection of geocoded points that differ in how they were calculated and their suggested use. For a description of the points in this collection, see the Geocode Point Fields section below. Defines a rectangular area by using latitude and longitude boundaries that contain the corresponding route or location. A bounding box contains SouthLatitude, WestLongitude, NorthLatitude, and EastLongitude elements. A type of location. Examples include PopulatedPlace and Monument. The postal address of a location. An Address can contain AddressLine, AdminDistrict, AdminDistrict2, CountryRegion, FormattedAddress, Locality, and PostalCode elements. The confidence of the match.

geocodePoints

GeocodePoint

collection

bbox

BoundingBox

BoundingBox. For more information about the BoundingBox type, see Location and Area Types.

entityType

EntityType

string

address

Address

Address

confidence

Confidence

One of the following values: High, Medium, Low, Unknown

341

JSON

XML

Type

Description

matchCodes

MatchCode

One or more of the following values: Good, Ambiguous, UpHierarchy

A collection of match code values that represent the geocoding level for each location in the response. The possible values are: Good: The location has only one match. Ambiguous: The location is one of a set of possible matches. For example, when you query for the street address 128 Main St., the response may return two locations for 128 North Main St. and 128 South Main St. because there is not enough information to determine which option to choose. UpHierarchy: The location represents a move up the geographic hierarchy. This occurs when a match for the location request was not found, so a less precise result is returned. For example, if a match for the requested address cannot be found, then a match code of UpHierarchy with a postal code may be returned.

Geocode Point Fields


342

The following fields are provided for each geocode point in the Geocode Points collection.
JSON XML Type Description

point

Point

Point. For more information about the Point type, see Location and Area Types. One of the following values: Interpolation: The geocode point was matched to a point on a road using interpolation. InterpolationOffset: The geocode point was matched to a point on a road using interpolation with an additional offset to shift the point to the side of the street. ParcelCentroid: The geocode point was matched to the center of a parcel. Rooftop: The geocode point was matched to the rooftop of a building.

The latitude and longitude coordinates of the geocode point. The method that was used to compute the geocode point.

calculationMethod

CalculationMethod

usageTypes

usageType

One or more of the following values: Display Route

The best use for the geocode point. Each geocode point is defined as a Route point, a Display point or both. Use Route points if you are creating a route to the location. Use
343

JSON

XML

Type

Description

Display points if you are showing the location on a map. For example, if the location is a park, a Route point may specify an entrance to the park where you can enter with a car, and a Display point may be a point that specifies the center of the park.

Itinerary Item Fields These fields are found in the ItineraryItem collection. Each itinerary item provides information about a route step.
JSON XML Type Description

childItineraryItems

ChildItineraryItems

collection

A collection of ItineraryItems that divides an itinerary item into smaller steps. An itinerary item can have only one set of ChildItineraryItems. The direction of travel associated with a maneuver on a route, such as south or southwest.

compassDirection

CompassDirection

string

This value is not supported for the Transit travel mode.


344

JSON

XML

Type

Description

details

Detail

collection

Information about one of the maneuvers that is part of the itinerary item. An ItineraryItem can contain more than one Detail collection. For information about the fields contained in a Detail collection, see the Detail Fields table below. The name or number of the exit associated with this itinerary step. Additional information that may be helpful in following a route. In addition to the hint text, this element has an attribute hintType that specifies what the hint refers to, such as NextIntersection. Hint is an optional element and a route step can contain more than one hint. The type of icon to display. Possible values include: None Airline Auto Bus Ferry Train Walk Other

exit

Exit

string

hints

Hint

string

iconType

IconType

string

instruction

Instruction

string

A description of a maneuver in a set of directions. In addition to the content of the instruction field, this field has an attribute maneuverType
345

JSON

XML

Type

Description

that is set to the type of maneuver, such as TurnLeft. maneuverPoint ManeuverPoint Point. For more information about the Point type, see Location and Area Types. The coordinates of a point on the Earth where a maneuver is required, such as a left turn. A ManeuverPoint contains Latitude and Longitude elements.

This value is not supported for ItineraryItems that are part of a ChildItineraryItems collection. sideOfStreet SideOfStreet string The side of the street where the destination is found based on the arrival direction. This field applies to the last itinerary item only. Possible values include: signs Sign string Left Right Unknown

Signage text for the route. There may be more than one sign value for an itinerary item. The arrival or departure time for the transit step. Examples: XML: 2011-10-7T9:37:47 JSON: 1318005467000-0700 The JSON response returns departure and arrival times as DateTime strings, such as
346

time

Time

DateTime

JSON

XML

Type

Description
1318005467000-0700.

The first integer in the string (1318005467000) represents the number of seconds since 12:00:00 midnight, January 1, 1970 UTC. The remainder of the string (-0700) represents an offset in hours that you must apply to get the local time. For example, the integer 1318005467000 represents the time '10/7/2011 4:37:47 PM'. When you apply the -0700 offset, you compute the local time as '10/7/2011 9:37:47 AM'. For more information, see DateTime Structure. tollZone towardsRoadName tollZone TowardsRoadName string string The name or number of the toll zone. The name of the street that the route goes towards in the first itinerary item. Information about the transit line associated with the itinerary item. For more information about the fields contained in the TransitLine collection, see the Transit Line Fields table below. The ID assigned to the transit stop by the transit agency. The end destination for the transit line in the direction you are traveling. The physical distance covered by this route step.

transitLine

TransitLine

collection

transitStopId transitTerminus

TransitStopId TransitTerminus

string string

travelDistance

TravelDistance

double

347

JSON

XML

Type

Description

This value is not supported for the Transit travel mode. travelDuration TravelDuration double The time in seconds that it takes to travel a corresponding TravelDistance. The mode of travel for a specific step in the route.

travelMode

TravelMode

string

This value is not supported for ItineraryItems that are part of a ChildItineraryItems collection. warnings Warning string Information about a condition that may affect a specific step in the route. Warning is an optional element and a route step can contain more than one warning. Warnings can include traffic incident information such as congestion, accident and blocked road reports. Warning elements are further defined by two attributes: Severity and WarningType. Severity can have the following values: Low Impact, Minor, Moderate, or Serious. See Warning Types for a list of warning types.

Detail Fields
348

Any detail fields that are returned in the response and that are not in this table are not supported.
JSON XML Type Description

compassDegrees

CompassDegrees

string

The direction in degrees.

This value is not supported for the Transit travel mode. maneuverType ManeuverType string The type of maneuver described by this detail collection. The ManeuverType in A detail collection can provide information for a portion of the maneuver described by the maneuverType attribute of the corresponding Instruction. For example the maneuverType attribute of an Instruction may specify TurnLeftThenTurnRight as the maneuver while the associated detail items may specify specifics about the TurnLeft and TurnRight maneuvers. For a list of maneuver types, see Maneuver Types. names Name string A street, highway or intersection where the maneuver occurs. If the maneuver is complex, there may be more than one name field in the details collection. The name field may also have no value. This can occur if the name is not known or if a street,
349

JSON

XML

Type

Description

highway or intersection does not have a name.

This value is only supported for the transit travel mode. StartPathIndices EndPathIndices StartPathIndex EndPathIndex strings These fields specify index values for specific route path points that are returned in the response when the routePathOutput parameter is set to Points. Together, these two index values define a range of route path points that correspond to a maneuver. Route path index values are integers where the first route path point has an index value of 0. The type of road. A traffic location code. Each location code provides traffic incident information for pre-defined road segments. There may be multiple codes for each Detail collection in the response. A subscription is typically required to be able to interpret these codes for a geographical area or country.

roadType locationCode

RoadType LocationCode

string string

Transit Line Fields

350

JSON

XML

Type

Description

verboseName abbreviatedName

VerboseName AbbreviatedName

string string

The full name of the transit line. The abbreviated name of the transit line, such as the bus number. The ID associated with the transit agency. The name of the transit agency. The color associated with the transit line. The color is provided as an RGB value. The color to use for text associated with the transit line. The color is provided as an RGB value. The URI for the transit agency. The phone number of the transit agency. The contact information for the provider of the transit information.

AgencyId

AgencyId

string

agencyName lineColor

AgencyName LineColor

string string

lineTextColor

LineTextColor

string

uri phoneNumber providerInfo

Uri PhoneNumber ProviderInfo

string string string

Route Path Fields A Route Path is included in the response when the RoutePathOutput parameter is set to Points in the request. The Route Path provides a set of latitude and longitude values that make up the route path. When tolerances are specified in the request, subsets of these points called route path generalizations are provided that can be used to represent the route on maps that do not need the accuracy of the complete set of points.

351

JSON

XML

Type

Description

line

Line

collection

A collection of point (latitude and longitude) elements. When the points in the line are connected, they represent the path of the route. The coordinates of a point on the Earth. A point contains Latitude and Longitude elements.

point

Point

Point. For more information about the point type, see Location and Area Types. collection

generalizations

RoutePathGeneralization

A generalization is a collection of index elements and a latlongtolerance element specifying a subset of route points that satisfy the tolerance. Specifies a subset of points from the complete set of route path points (line collection) to include in the RoutePathGeneralization. The list of point values in the route path line collection are given indices starting with 0. For example, an index value of 0 indicates that the first point in the Line collection is included in this RoutePathGeneralization. The tolerance specified in the route request that is associated with the RoutePathGeneralization.

pathIndices

Index

integer

latLongTolerance

LatLongTolerance

integer

352

Examples
See the following topics for response examples. Walking Route Example Driving Route Example Transit Route Example Driving Route with Route Path Example Driving Route using Tolerances Example

Maneuver Types
The following maneuver type values are returned the Routes API in the maneuverType field in the HTTP response. For more information about the values returned in the Routes API response, see Route Data.
Maneuver Type Instruction

ArriveFinish ArriveIntermediate BearLeft BearLeftThenBearLeft BearLeftThenBearRight BearLeftThenTurnLeft BearLeftThenTurnRight BearRight BearRightThenBearLeft

Arrive at the final destination. Arrive at an intermediate waypoint. Bear left. Bear left and then bear left again. Bear left and then bear right. Bear left and then turn left. Bear left and then turn right. Bear right. Bear right and then bear left.

BearRightThenBearRight BearRightThenTurnLeft BearRightThenTurnRight BearThenKeep BearThenMerge Continue DepartIntermediateStop DepartIntermediateStopReturning

Bear right and then bear right again. Bear right and then turn left. Bear right and then turn right. Bear instruction and then a keep instruction Bear instruction and then a merge instruction. Continue on the current road. Leave an intermediate waypoint in a different direction and road than you arrived on. Leave an intermediate waypoint in the same
353

Maneuver Type

Instruction

direction and on the same road that you arrived on. DepartStart EnterRoundabout ExitRoundabout EnterThenExitRoundabout KeepLeft KeepOnRampLeft KeepOnRampRight KeepOnRampStraight KeepRight KeepStraight KeepToStayLeft KeepToStayRight KeepToStayStraight Merge None RampThenHighwayLeft RampThenHighwayRight RampThenHighwayStraight RoadNameChange Take Leave the starting point. Enter a roundabout. Exit a roundabout. Enter and exit a roundabout. Keep left onto a different road. Keep left and continue onto ramp. Keep right and continue onto ramp. Keep straight and continue onto ramp. Keep right onto a different road. Keep straight onto a different road. Keep left to stay on the same road. Keep right to stay on the same road. Keep straight to stay on the same road. Merge onto a highway. No instruction. Take left ramp onto highway. This is part of a combined instruction. Take right ramp onto highway. This is part of a combined instruction. Stay straight to take ramp onto highway. This is part of a combined instruction. Road name changes. Take the road. This instruction is used when you are entering or exiting a ferry. For example the following two route instructions use the Take maneuver to tell the user to take the Seattle-Bainbridge ferry and then to exit the ferry onto Olympic Drive. Take Seattle-Bainbridge Ferry.
354

Maneuver Type

Instruction

TakeRampLeft TakeRampRight TakeRampStraight TakeTransit Transfer TransitArrive TransitDepart TurnBack TurnLeft TurnLeftThenBearLeft TurnLeftThenBearRight TurnLeftThenTurnLeft TurnLeftThenTurnRight TurnRight TurnRightThenBearLeft TurnRightThenBearRight TurnRightThenTurnLeft TurnRightThenTurnRight TurnThenMerge TurnToStayLeft TurnToStayRight Unknown UTurn Wait Walk

Take Olympic Drive.

Take ramp to the left. Take ramp to the right. Stay straight to take ramp. Take transit. Transfer between public transit at transit stop. Get off public transit at transit stop. Get on public transit at transit stop. Turn back sharply. Turn left. Turn left and then bear left. Turn left and then bear right. Turn left and then turn left again. Turn left and then turn right. Turn right. Turn right and then bear left. Turn right and then bear right. Turn right and then turn left. Turn right and then turn right again Turn instruction followed by a merge instruction. Turn left to stay on the same road. Turn right to stay on the same road. The instruction is unknown. Make a u-turn to go in the opposite direction. Wait at a transit stop. Walk.

355

Warning Types
The following warning type values are used to set the warningType attribute that is returned with warning text by the Routes API when there is a potential issue along a route segment. For more information about warnings and other information returned in the Routes API response, see Route Data.
Warning Type Description

Accident AdminDivisionChange BlockedRoad CheckTimetable Congestion CountryChange DisabledVehicle GateAccess GetOffTransit GetOnTransit IllegalUTurn MassTransit Miscellaneous NoIncident None Other OtherNews OtherTrafficIncidents PlannedEvents PrivateRoad

There is a traffic accident. The route has left one administrative division and entered another. The road is closed or blocked. Check a time table. This usually refers to a ferry or Autorail time table. The traffic is slow. The route has left one country and entered another. There is a disabled vehicle. A gate blocks the road and access is required to continue along the route. Get off the transit at this location. Get on the transit at this location. A U-turn is illegal at this location. There is mass transit incident. A miscellaneous warning is available for this location. There is no incident at this location. There is no warning at this location. There is a warning at this location that cannot be classified as any other type of warning. There is additional traffic incident information. There are other traffic incidents at this location. There are scheduled events in the area. The road being travelled on is private.
356

Warning Type

Description

RestrictedTurn RoadClosures RoadHazard ScheduledConstruction

The turn may be restricted. There are road closures at this location. There is a road hazard. There is construction along the route. The ScheduledConstruction value is used for any type of construction and not just construction that has specific start and end dates. A seasonal closure occurs at this location. A toll is required at this location to continue along the route. The road is a toll road. The entrance to a toll zone. The exit of a toll zone. The warning is about traffic flow. There is a transit line change but a change of vehicle is not required. The road is unpaved. There is significant weather at this location.

SeasonalClosures Tollbooth TollRoad TollZoneEnter TollZoneExit TrafficFlow TransitLineChange UnpavedRoad Weather

Traffic API
Use the Traffic API to get information about traffic incidents and issues, such as construction sites and traffic congestion. For traffic incident coverage by country, see Bing Maps Traffic Coverage. For an overview of how traffic incident information is returned by the Routes API and the Traffic API, see Getting Traffic Incident Data.

In this section
Get Traffic Incidents Traffic Incident Data Use this URL to get information about traffic incidents and issues. Use this description to understand the results returned for a Traffic API request.

357

Get Traffic Incidents


Use the following URL template to request traffic incident information. A collection of traffic incidents is returned in the response. For more information about the traffic incident data that is returned in the response, see Traffic Incident Data. You can also view the example URL and response values in the Examples section below. For an overview of how traffic incident information is returned by Bing Maps REST Services, see Getting Traffic Incident Data. For traffic coverage by country, see Bing Maps Traffic Coverage.

URL Templates
These templates support both HTTP and HTTPS protocols. Get traffic incidents.
http://dev.virtualearth.net/REST/v1/Traffic/Incidents/mapArea/includeLocationCodes?severi ty=severity1,severity2,severityn&type=type1,type2,typen&key=BingMapsKey

Template Parameters

See the Common Parameters and Types section for additional common parameters to use with these URLs. Common parameters include: Output Parameters: Includes response output types and the JSON callback parameters. Culture Parameter: Includes a list of the supported cultures. When an alias is provided, you can use the alias to shorten the length of the query parameter. For example, severity=6,9 can be shortened to s=6,9. Parameter values are not case-sensitive.
Parameter Alias Description Values

mapArea

Required. Specifies the area to search for traffic incident information.

A rectangular area specified as a bounding box. The size of the area can be a maximum of 500 km x 500 km. A bounding box defines an area by specifying SouthLatitude, WestLongitude, NorthLatitude, and EastLongitude values.
358

Parameter

Alias

Description

Values

For more information, see Location and Area Types. Example: 45.219,122.325,47.610,122.107 includeLocationCodes Optional. Specifies whether to include traffic location codes in the response. Traffic location codes provide traffic incident information for pre-defined road segments. A subscription is typically required to be able to interpret these codes for a geographical area or country. s One of the following values: true false [default]

If you want to use the default value, you can omit this parameter from the URL request.

severity

Optional. Specifies One or more of the severity level of traffic following integer values: incidents to return. 1: LowImpact 2: Minor 3: Moderate 4: Serious

The default is to return traffic incidents for all severity levels. Examples: severity=2,3,4 s=2,3,4 type t Optional. Specifies the type of traffic incidents to return. One or more of the following integer values: 1: Accident 2: Congestion 3: DisabledVehicle
359

Parameter

Alias

Description

Values

4: MassTransit 5: Miscellaneous 6: OtherNews 7: PlannedEvent 8: RoadHazard 9: Construction 10: Alert 11: Weather

Examples: type=2 t=2,9

Response
A collection of TrafficIncident resources is returned when you make a request with the URL above. For more information about the TrafficIncident resource, see Traffic Incident Data. For more information about the common response syntax for the Bing Maps REST Services, see Common Response Description. These URLs support JSON (application/json) and XML (application/xml) response formats. A JSON response is provided by default, unless you request XML output by setting the output (o) parameter. For more information, see Output Parameters. JSON and XML responses are provided for the URL examples in the following section.

Examples
Get all traffic incidents in a specified area. The following example shows how to request all traffic incident for an area defined as a bounding box (South Latitude, West Longitude, North Latitude, East Longitude). For more information about defining a bounding box, see Location and Area Types. Note that the includeLocationCodes parameter is not specified in this example.

http://dev.virtualearth.net/REST/v1/Traffic/Incidents/37,-105,45,-94?key=YourBingMapsKey

JSON Response This URL returns a response with the following format that includes a list of traffic incidents as traffic incident resources. For more information on the fields returned for a traffic incident resource, see Traffic Incident Data.
{ "authenticationResultCode":"ValidCredentials", 360

"brandLogoUri":"http:\/\/dev.virtualearth.net\/Branding\/logo_powered_by.png", "copyright":"Copyright 2011 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.", "resourceSets":[ { "estimatedTotal":131, "resources":[ {

"__type":"TrafficIncident:http:\/\/schemas.microsoft.com\/search\/local\/ws\/rest\/v1", "point":{ "type":"Point", "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 }, {

361

"__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 } ] } ], "statusCode":200, "statusDescription":"OK", "traceId":"38491198bf6a42f5b7e60c18aa08ec02" }

XML Response If the output parameter is specified and set to xml (o=xml) in this URL, the URL returns a response with the following format.

362

<Response xmlns="http://schemas.microsoft.com/search/local/ws/rest/v1" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchemainstance"> <Copyright>Copyright 2011 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.</Copyright> <BrandLogoUri>http://dev.virtualearth.net/Branding/logo_powered_by.png</BrandLogoUri> <StatusCode>200</StatusCode> <StatusDescription>OK</StatusDescription> <AuthenticationResultCode>ValidCredentials</AuthenticationResultCode> <TraceId>c0f1945558bf49ceb0b35816d5bca10</TraceId> <ResourceSets> <<ResourceSet> <EstimatedTotal>128</EstimatedTotal <Resources> <TrafficIncident> <Point> <Latitude>38.85135</Latitude> <Longitude>-94.34033</Longitude> </Point> <IncidentId>210546697</IncidentId> <LastModifiedUTC>2011-06-29T23:44:56.593Z</LastModifiedUTC> <StartTimeUTC>2011-06-06T13:00:00Z</StartTimeUTC> <EndTimeUTC>2011-07-11T15:00:00Z</EndTimeUTC> <Type>Construction</Type> <Severity>Moderate</Severity> <Verified>true</Verified> <RoadClosed>true</RoadClosed> <Description>MO-150 is closed between 5th Ave S and Court Dr construction</Description> <DetourInfo/> <LaneInfo/> <CongestionInfo/> </TrafficIncident> 363

<TrafficIncident> <Point> <Latitude>38.85872</Latitude> <Longitude>-94.54638</Longitude> </Point> <IncidentId>191097424</IncidentId> <LastModifiedUTC>2011-06-29T23:44:56.593Z</LastModifiedUTC> <StartTimeUTC>2011-01-22T14:00:00Z</StartTimeUTC> <EndTimeUTC>2011-09-05T17:46:00Z</EndTimeUTC> <Type>Construction</Type> <Severity>LowImpact</Severity> <Verified>true</Verified> <RoadClosed>true</RoadClosed> <Description>Botts Rd is closed between Andrews Rd and 142nd St construction</Description> <DetourInfo>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</DetourInfo> <LaneInfo/> <CongestionInfo/> </TrafficIncident> </Resources> </ResourceSet> </ResourceSets> </Response>

Get traffic incidents by type and severity and request traffic location codes. The following example queries for congestion type traffic incidents (t=9) that are minor or moderate in severity (s=2,3) and that occur in the bounding box defined by the coordinates (37.0,-105.45,45.0,-94.0). Traffic location codes are requested by setting the includeLocationCodes value 'true' in the URL. The requested output format is XML.
http://dev.virtualearth.net/REST/V1/Traffic/Incidents/37,-105,45,94/true?t=9,2&s=2,3&o=xml&key=BingMapsKey 364

XML Response This URL returns an XML response with the following format.
<Response xmlns="http://schemas.microsoft.com/search/local/ws/rest/v1" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchemainstance"> <Copyright>Copyright 2011 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.</Copyright> <BrandLogoUri>http://dev.virtualearth.net/Branding/logo_powered_by.png</BrandLogoUri> <StatusCode>200</StatusCode> <StatusDescription>OK</StatusDescription> <AuthenticationResultCode>ValidCredentials</AuthenticationResultCode> <TraceId>3f09332c6ed44048bf8e9e19198fd154</TraceId> <ResourceSets> <ResourceSet> <EstimatedTotal>91</EstimatedTotal>-<Resources> <TrafficIncident> <Point> <Latitude>38.64829</Latitude> <Longitude>-94.36405</Longitude> </Point><IncidentId>214828828</IncidentId> <LastModifiedUTC>2011-07-11T12:02:30.29Z</LastModifiedUTC> <StartTimeUTC>2011-07-08T12:00:00Z</StartTimeUTC> <EndTimeUTC>2011-09-17T00:00:00Z</EndTimeUTC> <Type>Construction</Type><Severity>Minor</Severity> <Verified>true</Verified><RoadClosed>false</RoadClosed> <Description>in both directions between MO-2/MO-7 and MO-291/Cantrell Rd construction</Description> <DetourInfo/> <LaneInfo>Total Lanes lane blocked</LaneInfo> <CongestionInfo/> <ToPoint> <Latitude>38.65831</Latitude> <Longitude>-94.36706</Longitude> 365

</ToPoint> <LocationCodes> <string>119+05041</string> <string>119+05042</string> <string>119-05041</string> <string>119-05042</string> <string>119N05041</string> <string>119N05042</string> <string>119P05041</string> <string>119P05042</string> </LocationCodes> </TrafficIncident> <TrafficIncident> <Point> <Latitude>38.80371</Latitude> <Longitude>-94.43887</Longitude> </Point> <IncidentId>213728243</IncidentId> <LastModifiedUTC>2011-07-11T12:02:30.29Z</LastModifiedUTC> <StartTimeUTC>2011-06-22T12:00:00Z</StartTimeUTC> <EndTimeUTC>2011-07-31T22:00:00Z</EndTimeUTC> <Type>Construction</Type> <Severity>Minor</Severity> <Verified>true</Verified> <RoadClosed>false</RoadClosed> <Description>SB MO-J between MO-58 and US-71 - construction</Description> <DetourInfo/> <LaneInfo>Total Lanes lane blocked</LaneInfo> <CongestionInfo/> </TrafficIncident> </Resources> </ResourceSet> </ResourceSets> </Response> 366

JSON Response If the output parameter was not specified in this URL, a JSON response with the following format is returned.
{ "authenticationResultCode":"ValidCredentials", "brandLogoUri":"http:\/\/dev.virtualearth.net\/Branding\/logo_powered_by.png", "copyright":"Copyright 2011 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.", "resourceSets":[ { "estimatedTotal":91, "resources":[ {

"__type":"TrafficIncident:http:\/\/schemas.microsoft.com\/search\/local\/ws\/rest\/v1", "point":{ "type":"Point", "coordinates":[ 38.64829, -94.36405 ] }, "congestion":"", "description":"in both directions between MO-2\/MO-7 and MO-291\/Cantrell Rd - construction", "detour":"", "end":"\/Date(1316217600000)\/", "incidentId":214828828, "lane":"Total Lanes lane blocked", "lastModified":"\/Date(1310385750290)\/", "roadClosed":false, "severity":2, "start":"\/Date(1310126400000)\/", 367

"toPoint":{ "type":"Point", "coordinates":[ 38.65831, -94.36706 ] }, "locationCodes":[ "119+05041", "119+05042", "119-05041", "119-05042", "119N05041", "119N05042", "119P05041", "119P05042" ], "type":9, "verified":true }, {

"__type":"TrafficIncident:http:\/\/schemas.microsoft.com\/search\/local\/ws\/rest\/v1", "point":{ "type":"Point", "coordinates":[ 38.80371, -94.43887 ] }, "congestion":"", "description":"SB MO-J between MO-58 and US-71 - construction", "detour":"", "end":"\/Date(1312149600000)\/", 368

"incidentId":213728243, "lane":"Total Lanes lane blocked", "lastModified":"\/Date(1310385750290)\/", "roadClosed":false, "severity":2, "start":"\/Date(1308744000000)\/", "type":9, "verified":true } ] } ], "statusCode":200, "statusDescription":"OK", "traceId":"9c2944a197db4457bb8d4def0007b657" }

HTTP Status Codes


For more details about these HTTP status codes, see Status Codes and Error Handling. When the request is successful, the following HTTP status code is returned. 200 400 401 404 500 503 When the request is not successful, the response returns one of the following errors.

Traffic Incident Data


The response returned by a Traffic URL contains one or more TrafficIncident resources. Each TrafficIncident resource contains information about a traffic issues that met the criteria specified in the URL request, such as map area, incident type and severity. This following table provides descriptions of the TrafficIncident resource fields and is followed by JSON and XML examples.

369

Traffic Incident Resource


The following table describes the fields in the traffic incident resource. One or more traffic incident resources are returned when you request traffic data. These resources are inside a common response wrapper for the Bing Maps REST Services. For more information about the common response wrapper, see Common Response Description. Fields marked Required are always provided for each traffic incident. Other fields are optional and not always included.
JSON XML Type Description

point

Point

Required. Point.

The latitude and longitude coordinates where you encounter the incident. A description of the congestion. Examples: generally slow sluggish

congestion

CongestionInfo

string

description

Description

string

A description of the incident. Examples: W 95th St between Switzer Rd and Bluejacket Dr construction WB Johnson Dr at I435 - bridge repair

detour detourInfo string

A description of a detour. Examples: Take 63rd St to Roe Ave and head south to 67th St take US-40 to Blue Ridge Cut-Off

start StartTimeUTC UTC Time

Required. The time the incident occurred. For more information about the format, see the About Time Values section below.
370

JSON

XML

Type

Description

Examples: end EndTimeUTC UTC Time JSON: Date(1295704800000) XML: 2011-0629T23:44:56.593Z

Required. The time that the traffic incident will end. For more information about the format, see the About Time Values section below. Examples: JSON: Date(1295704800000) XML: 2011-0629T23:44:56.593Z

incidentId lane

IncidentId LaneInfo

long string

Required. A unique ID for the incident. A description specific to lanes, such as lane closures. Examples: All lanes blocked Left lane blocked

lastModified

LastModifiedUTC

DateTime

Required. The time the incident information was last updated. For more information about the format, see the About Time Values section below. Examples: JSON: Date(1295704800000) XML: 2011-0629T23:44:56.593Z

roadClosed

RoadClosed

boolean

Required. A value of true indicates that there is a


371

JSON

XML

Type

Description

road closure. severity Severity integer Required. Specifies the level of importance of incident. toPoint ToPoint Point 1: LowImpact 2: Minor 3: Moderate 4: Serious

The coordinates of the end of a traffic incident, such as the end of a construction zone.

locationCodes

LocationCodes

string collection

A collection of traffic location codes. This field is provided when you set the includeLocationCodes parameter to true in the request. These codes associate an incident with pre-defined road segments. A subscription is typically required to be able to interpret these codes for a geographical area or country. Required. Specifies the type of incident. 1: Accident 2: Congestion 3: DisabledVehicle 4: MassTransit 5: Miscellaneous 6: OtherNews
372

type

Type

integer

JSON

XML

Type

Description

verified Verified boolean

7: PlannedEvent 8: RoadHazard 9: Construction 10: Alert 11: Weather

Required. A value of true indicates that the incident has been visually verified or otherwise officially confirmed by a source like the local police department.

About time values Time values in the TrafficIncident resource data use UTC time. The format for XML and JSON responses are different. For JSON responses, the time is specified as UTC time in seconds and uses the following format.
Date(seconds)

JSON Example: Date(1295704800000) For XML responses, the time is specified as UTC time and uses the following format. A time zone offset is not specified.
YYYY-MM-DDThh:mm:ss.sZ

XML Example: 2011-06-29T23:44:56.593Z For more information about UTC time see W3C Date and Time Formats.

Examples
The following are TrafficIncident Data resource examples. To see the complete response including the common response container, see the examples in Get Traffic Incidents and the Common Response Description. JSON Example
{

"__type":"TrafficIncident:http:\/\/schemas.microsoft.com\/search\/local\/ws\/rest\/v1", "point":{ "type":"Point", "coordinates":[

373

38.64829, -94.36405 ] }, "congestion":"", "description":"in both directions between MO-2\/MO-7 and MO-291\/Cantrell Rd construction", "detour":"", "end":"\/Date(1316217600000)\/", "incidentId":214828828, "lane":"Total Lanes lane blocked", "lastModified":"\/Date(1310385750290)\/", "roadClosed":false, "severity":2, "start":"\/Date(1310126400000)\/", "toPoint":{ "type":"Point", "coordinates":[ 38.65831, -94.36706 ] }, "locationCodes":[ "119+05041", "119+05042", "119-05041", "119-05042", "119N05041", "119N05042", "119P05041", "119P05042" ], "type":9, "verified":true 374

XML Example
<TrafficIncident> <Point> <Latitude>38.64829</Latitude> <Longitude>-94.36405</Longitude> </Point> <IncidentId>214828828</IncidentId> <LastModifiedUTC>2011-07-11T12:02:30.29Z</LastModifiedUTC> <StartTimeUTC>2011-07-08T12:00:00Z</StartTimeUTC> <EndTimeUTC>2011-09-17T00:00:00Z</EndTimeUTC> <Type>Construction</Type> <Severity>Minor</Severity> <Verified>true</Verified> <RoadClosed>false</RoadClosed> <Description>in both directions between MO-2/MO-7 and MO-291/Cantrell Rd construction</Description> <DetourInfo/> <LaneInfo>Total Lanes lane blocked</LaneInfo> <CongestionInfo/> <ToPoint> <Latitude>38.65831</Latitude> <Longitude>-94.36706</Longitude> </ToPoint> <LocationCodes> <string>119+05041</string> <string>119+05042</string> <string>119-05041</string> <string>119-05042</string> <string>119N05041</string> <string>119N05042</string> <string>119P05041</string> <string>119P05042</string> </LocationCodes> 375

</TrafficIncident>

Common Parameters and Types


The Bing Maps REST Services use many common parameters and types. The topics in this section describe these common parameters and types.

In this section
Bing Maps REST URL Structure Culture Parameter Use the base URL for making calls to the Bing Maps REST Services. Use the culture parameter to set the culture so that items such as map labels and route directions are in the desired language. Use the output parameter to specify the format of the response, such as JSON or XML. Use the user-context parameters to specify information about the user, such as the users location. Use the location types to define a location or geographical area. Use the pushpin syntax to specify pushpins on a map. Use the entity type descriptions to understand the entity types returned by the Bing Maps REST Services. Use the list of supported culture codes to determine the languages supported by the Bing Maps REST Services.

Output Parameters User Context Parameters

Location and Area Types Pushpin Syntax and Icon Styles Entity Types

Supported Culture Codes

Bing Maps REST URL Structure


The Bing Maps REST Services are all called by using the following base formats. HTTP protocol
http://dev.virtualearth.net/REST/version/restApi/resourcePath?queryParameters&key=BingMap sKey

376

HTTPS protocol
https://dev.virtualearth.net/REST/version/restApi/resourcePath?queryParameters&key=BingMa psKey

Template Parameters
All parameters in the Bing Maps REST Services are not case-sensitive.
URL parameter Description Values

version (v+ API version number)

Required. The version of the Bing Maps REST Services that you want to use. Required. The REST API that you want to use.

A string containing v and an integer that specifies the version of the Bing Maps REST Services. Example: v1. A part of the URL path that identifies the REST API. Example: Imagery/Map

restApi

resourcePath

Optional. Additional parameters that define a resource

A part of the URL path that specifies a resource, such as an address or landmark. Example: BirdsEye/51.5063249319792,0.127144753932953

key

Required. The Bing Maps A Bing Maps Key obtained from the Key to use for the request. Bing Maps Account Center Example: key=A3sbe47EeFWsSlklbe

Although it is described separately in this table because of its importance, the Bing Maps Key is a query parameter. queryParameters Optional with exceptions. One or more parameters and values Depending on the request, query parameters may be optional or required. Query parameters consist
377

URL parameter

Description

Values

that define the request.

of global parameters and parameters that are specific to each REST API. The Bing Maps Key is a required query parameter. Example: userLocation=49.1231,98.231

Example
The following example request specifies to use version one (v1) of the Bing Maps REST Services to find location information for the city of Seattle. The information will be returned in an XML format.
http://dev.virtualearth.net/REST/v1/Locations?q=seattle&output=xml&key=BingMapsKey

Culture Parameter
Use the culture parameter to specify a culture for your request. The culture parameter provides the following strings in the language of the culture for: 1. Geographic entities and place names returned by the Bing Maps REST Services 2. Map labels on map images 3. Route instructions You can use the alias to shorten the length of the culture parameter. For example, culture=da can be shortened to c=da.
Parameter Alias Description Values

culture

Optional. The culture to For a list of supported use for the request. cultures, see Supported Culture Codes.

Example
The following example finds the location for an address string and provides the information in German, which is the language associated with the culture code de.
http://dev.virtualearth.net/REST/v1/Locations/Brsenplatz%201%20Frankfurt%20am%20Main%20H essen%2060313?c=de&key=BingMapsKey

378

Output Parameters
Use output parameters to specify the output of the request. When an alias is provided, you can use the alias to shorten the length of the query parameter. For example, output=xml can be shortened to o=xml.
Parameter Alias Description Values

output

Optional. The output format for the response.

One of the following values: json [default] xml Example: output=xml

suppressStatus

ss

Optional. When set to true, the HTTP Status returned is 200 OK for all responses, including when there are errors. The content of the response always contains the actual HTTP Status. Optional. Name of JSON callback function that is called when the response to the request is received. The JSON object provided in the response is passed to the callback function.

true false [default]

Example: suppressStatus=true

jsonp

A string that contains the name of the callback function. Example: jsonp=MyCallbackFunction

jsonso

Optional. The state Any valid JavaScript string. object to pass to the Example: jsonso=abc3144sd JSON callback function. You can use a state object to match a response with a specific call. This value is
379

Parameter

Alias

Description

Values

provided as the second parameter to the callback function provided in the JSONP parameter.

Examples
This example returns the template that you can use to build a map that shows roads. The output is requested in XML format.
http://dev.virtualearth.net/REST/v1/Imagery/Metadata/Road?output=xml&key=BingMapsKey

This example returns the following response. The URL template is provided by the ImageURL element.
<Response xmlns:xsi="http://www.w3.org/2001/XMLSchema instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/search/local/ws/rest/v1"> <Copyright>Copyright 2010 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.</Copyright> <BrandLogoUri>http://dev.virtualearth.net/Branding/logo_powered_by.png</BrandLogoUri> <StatusCode>200</StatusCode> <StatusDescription>OK</StatusDescription> <AuthenticationResultCode>ValidCredentials</AuthenticationResultCode> <TraceId>55da9336cd984609b45a91fc9fc26905</TraceId> <ResourceSets> <ResourceSet> <EstimatedTotal>1</EstimatedTotal> <Resources> <ImageryMetadata> <ImageUrl>http://ecn.{subdomain}.m3.tiles.live int.com/tiles/r{quadkey}.jpeg?g=58&mkt={culture}&shading=hill&stl=H</ImageUrl> <ImageUrlSubdomains> <string>t0</string> <string>t1</string> 380

<string>t2</string> <string>t3</string> </ImageUrlSubdomains> <ImageWidth>256</ImageWidth> <ImageHeight>256</ImageHeight> <ZoomMin>1</ZoomMin> <ZoomMax>19</ZoomMax> </ImageryMetadata> </Resources> </ResourceSet> </ResourceSets> </Response>

This example gets a JSON object and specifies a callback function and a state parameter value.
http://dev.virtualearth.net/REST/v1/Imagery/Metadata/Road?output=json&jsonp=MyCallbackFun ction&jsonso=abc3144sd&key=BingMapsKey

For this example, the body of the response contains the following function call.
MyCallbackFunction({"authenticationResultCode":"ValidCredentials", "brandLogoUri":"http:\/\/dev.virtualearth.net\/Branding\/logo_powered_by.png", "copyright":"Copyright 2010 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.",

"resourceSets":[{"estimatedTotal":1,"resources":[{"__type":"ImageryMetadata:http:\/\/sche mas.microsoft.com\/search\/local\/ws\/rest\/v1", "imageHeight":256,

"imageUrl":"http:\/\/ecn.{subdomain}.tiles.virtualearth.net\/tiles\/r{quadkey}.jpeg?g=470 &mkt={culture}&shading=hill&stl=H", "imageUrlSubdomains":["t0","t1","t2","t3"], "imageWidth":256, "imageryProviders":null, "vintageEnd":null,"vintageStart":null, 381

"zoomMax":19,"zoomMin":1}]}], "statusCode":200, "statusDescription":"OK", "traceId":"d172cd085d624f2cab9b2c0a07ae06f1"}, "abc3144sd")

User Context Parameters


Use user context parameters to specify information about the user. You can increase the accuracy of a location result when you specify a user context parameter in your request URL. When an alias is provided, you can use the alias to shorten the length of the query parameter.
Parameter Alias Description Values

userMapView

umv

Optional. The geographic region that corresponds to the current viewport.

A rectangular area on the earth defined as a bounding box object. The sides of the rectangles are defined by latitude and longitude values. For more information, see Location and Area Types. When you specify this parameter, the geographical area is taken into account when computing the results of a location query. Example: 40.879052728414536,122.51596324145794,49.77062925696373,105.74403114616871

userLocation

ul

Optional. The users current position.

A point on the earth specified as a latitude and longitude. When you specify this parameter, the users location is taken into account and the results returned may be more relevant to the user. Example: userLocation=51.504360719046616,0.12600176611298197

userIp

uip

Optional. An Internet Protocol version 4 (IPv4) address.

The default address is the IPv4 address of the request. When you specify this parameter, the location associated with the IP address is taken into account in computing the results of a location query. Example: userIp=111.111.11.11

382

Location and Area Types


Use the following formats to specify locations and areas on the Earth.
Type Description Values and Syntax

Point

A point on the Earth specified by a latitude and longitude.

The coordinates are double values that are separated by commas and are specified in the following order. Latitude,Longitude Use the following ranges of values: Latitude (degrees): [-90, +90] Longitude (degrees): [180,+180]

Example: 47.610679194331169,122.10788659751415 BoundingBox A rectangular area on the Earth. A bounding box is defined by two latitudes and two longitudes that represent the four sides of a rectangular area on the Earth. Use the following syntax to specify a bounding box. South Latitude, West Longitude, North Latitude, East Longitude Example: 45.219,122.325,47.610,-122.107 Address Details about a point on the Earth that has additional location information. An address can contain the following fields: address line, locality, neighborhood, admin district, admin district 2, formatted address, postal code and country or region. For descriptions see the Address Fields section below.

Address Fields
Address Description

addressLine

The official street line of an address relative to


383

Address

Description

the area, as specified by the Locality, or PostalCode, properties. Typical use of this element would be to provide a street address or any official address. Example: 1 Microsoft Way locality A string specifying the populated place for the address. This typically refers to a city, but may refer to a suburb or a neighborhood in certain countries. Example: Seattle neighborhood A string specifying the neighborhood for an address. Example: Ballard adminDistrict A string specifying the subdivision name in the country or region for an address. This element is typically treated as the first order administrative subdivision, but in some cases it is the second, third, or fourth order subdivision in a country, dependency, or region. Example: WA adminDistrict2 A string specifying the subdivision name in the country or region for an address. This element is used when there is another level of subdivision information for a location, such as the county. Example: King formattedAddress A string specifying the complete address. This address may not include the country or region. Example: 1 Microsoft Way, Redmond, WA 98052-8300 postalCode A string specifying the post code, postal code, or ZIP Code of an address. Example: 98178 countryRegion A string specifying the country or region name of an address. Example: United States
384

Address

Description

landmark

A string specifying the name of the landmark when there is a landmark associated with an address. Example: Eiffel Tower

Pushpin Syntax and Icon Styles


Pushpins identify locations on a map. You can specify an icon style and a label for a pushpin, in addition to its location.

You can specify up to 18 pushpins within a Get a Static Map URL that uses HTTP GET protocol. However, if you use the HTTP POST method option, you can specify up to 100 pushpins by inserting them into the request body. See the HTTP POST Syntax section below for information about how to format the pushpins in a request body. The Get a Static Map topic provides more details and an example. The following table shows the syntax to use to specify a pushpin location.
pushpin=latitude,longitude;iconStyle;label

You can use the alias pp if you do not want to spell out pushpin. A latitude and a longitude are required. You can optionally specify an icon style and a label for the pushpin. A length of a label string is limited to three characters. The following table shows the options for specifying a pushpin.
Description Syntax

Specify a pushpin location.

latitude,longitude Example: pushpin=47.620548,-122.34874

Specify a pushpin location and an icon style.

latitude,longitude;iconStyle Example: pushpin=47.620548,-122.34874;5

Specify a pushpin location and a label.

latitude,longitude;;label

The order of the syntax requires that if you specify a label without specifying an icon style, you must preserve the syntax and put two semi-colons between the coordinates and the label.
385

Description

Syntax

Example: pushpin=47.620548,-122.34874;;P10 Specify a pushpin location, an icon style, and a label. A label can have up to three (3) characters. latitude,longitude;iconStyle;label Example: pushpin=47.620548,122.34874;5;P10

HTTP POST Syntax


If you use the HTTP POST method for specifying pushpins on a static map, you must include the pushpins in the body of the request. When specifying multiple pushpins in the request body, you must the ampersand character (&) or a carriage return (\r\n) as a delimiter. Pushpins that follow a carriage return (appear on a new line) do not have ampersands. The following examples show how to specify pushpins in the body of an HTTP POST request. For more information about this type of request, see Get a Static Map. Example 1
pp=38.889586530732335,-77.05010175704956;23;LMT\r\n pp=38.88772364638439,-77.0472639799118;7;KMT\r\n pp=38.890479451480054,-77.04744637012482;1;VMT\r\n pp=38.8896854931628,-77.03519403934479;45;WMT

Example 2
pp=38.889586530732335,-77.05010175704956;23;LMT&pp=38.88772364638439,77.0472639799118;7;KMT\r\n pp=38.890479451480054,-77.04744637012482;1;VMT&pp=38.8896854931628,77.03519403934479;45;WMT

Icon Styles
The following table shows the available pushpin icon styles.
IconStyle Icon

386

IconStyle

Icon

1 [default]

387

IconStyle

Icon

10

11

12

13

14

388

IconStyle

Icon

15

16

17

18

19

20

21

389

IconStyle

Icon

22

23

24

25

26

27

28

390

IconStyle

Icon

29

30

31

32

33

34

35

391

IconStyle

Icon

36

37

38

39

40

41

42

392

IconStyle

Icon

43

44

45

46

47

48

393

IconStyle

Icon

49

50

51

52

53

54

394

IconStyle

Icon

55

56

57

58

59

60

61

395

IconStyle

Icon

62

63

64

65

66

67

396

IconStyle

Icon

68

69

70

71

397

IconStyle

Icon

72

Entity Types
Entity type identifies a location. The following table lists the available entity types.
EntityType Description

Address AdminDivision1

A physical address of a location. A first-order, initial political subdivision of a [Sovereign], such as a state, a province, a department, a region, or a prefecture. A second-order political subdivision of a [CountryRegion], a division of an [AdminDivision1] or a [Dependent]. A third-order political subdivision of a [CountryRegion], a division of an [AdminDivision2]. A building that contains governmental offices or facilities. An administrative division of a [CountryRegion], undifferentiated as to administrative level. A [Structure] used for agricultural purposes. A place where aircraft regularly land and take off, with runways, navigational aids, and facilities for handling passengers and/or cargo. An improved surface suitable for landing airplanes. A facility that contains rides and other
398

AdminDivision2

AdminDivision3

AdministrativeBuilding AdministrativeDivision AgriculturalStructure Airport

AirportRunway AmusementPark

EntityType

Description

attractions, such as a theme park. AncientSite Aquarium Archipelago Autorail Basin Battlefield Bay Beach BorderPost A place where archeological remains, old structures, or cultural artifacts are located. A place where marine life is displayed to the public. A logical grouping of [Island]s. A [Railway] that carries automobiles. A low-lying area mostly or wholly surrounded by higher ground. A site of a land battle of historical importance. An area of water partially enclosed by an indentation of shoreline. A [Coast] with a surface of sand, pebbles, or small rocks. A post or station at an international boundary for regulating the movement of people and goods. A structure erected across an obstacle, such as a stream or road, that is used by vehicles and pedestrians. A category that identifies a kind of business. A place where a number of businesses are located. A name that identifies a business. A [Structure] used for commercial purposes. A place where buses pick up and discharge passengers. A site occupied by tents, huts, or other shelters for temporary use. An artificially constructed watercourse. An underground passageway or chamber, or a cavity on the side of a cliff.

Bridge

BusinessCategory BusinessCenter BusinessName BusinessStructure BusStation Camp Canal Cave

399

EntityType

Description

CelestialFeature Cemetery Census1 Census2

A spherical body in space. A burial place or a burial ground. One of the set of the most detailed, lowest-level [CensusDistrict]s. One of the set of second-order [CensusDistrict]s composed by aggregating [Census1]s. A district defined by a national census bureau and used for statistical data collection. A body of water between two landmasses. A building for public Christian worship. A building that contains the administrative offices of a municipal government. A high, steep-to-perpendicular slope that overlooks a lower area or a water body. An area of homogenous climactic conditions, as defined by modified Koeppen classes. An area of land adjacent to a [WaterFeature]. A facility for community recreation and meetings. A very large landmass, surrounded by water and larger than an [Island], that forms one of the primary divisions of land on a [CelestialFeature]. A large meeting hall for conventions and other meetings, and shows. A primary [PoliticalUnit]. A building in which courts of law are held. A generally circular, saucer-shaped, or bowlshaped depression caused by volcanic or meteorite explosive action. An area of land with strong local identity, but no political status.
400

CensusDistrict Channel Church CityHall Cliff ClimateRegion Coast CommunityCenter Continent

ConventionCenter CountryRegion Courthouse Crater

CulturalRegion

EntityType

Description

Current Dam Delta

A large area of ocean where surface water flows in a certain constant general direction. A barrier constructed across a stream to impound water. An area where a [River] divides into many separate water channels as it enters a [Sea] or a [Lake]. A [PoliticalUnit] that is politically controlled by a [Sovereign], but separate geographically, and to some degree politically, such as a territory, a colony, or a dependency. A large area with low rainfall and little or no vegetation. An area in political dispute that is not considered part of any [CountryRegion]. A land region where all surface water drains into one specific [WaterFeature]. A wave form, a ridge, or a star-shaped feature composed of sand. A place where the destructive force of a specific earthquake is centered. A region with a homogeneous ecosystem, flora, and/or fauna. A place for providing instruction. An area where the surface elevation of all land is within a defined range. A building or set of buildings where goods are manufactured, processed, or fabricated. A route used by a boat, or by other floating conveyances regularly used to transport people and vehicles across a [WaterFeature]. A structure and associated facilities where a ferry boat docks and takes on passengers, automobiles, and/or cargo.
401

Dependent

Desert DisputedArea DrainageBasin Dune EarthquakeEpicenter Ecoregion EducationalStructure ElevationZone Factory FerryRoute

FerryTerminal

EntityType

Description

FishHatchery Forest FormerAdministrativeDivision FormerPoliticalUnit FormerSovereign Fort Garden GeodeticFeature

A place for hatching fish eggs or raising fish. A large area of trees. An [AdministrativeDivision] that no longer exists. A [PoliticalUnit] that no longer exists. A [Sovereign] that no longer exists. A defensive structure or earthwork. An enclosure for displaying selected plant life. An invisible point, line, or area on the surface of a [CelestialFeature] that is used for geographic reference. A single thing that has spatial extent and location. One of the two points of intersection of the surface of a [CelestialFeature] and its axis of rotation. A [HotSpring] that intermittently shoots water into the air. A mass of ice, usually at high latitudes or high elevations, with sufficient thickness to flow away from the source area. A recreational field where golf is played. A [Structure] typically owned and operated by a governmental entity. A place where helicopters land and take off. A half of the surface of a [Celestial Feature], usually specified as northern, southern, eastern, or western. A place where students receive advanced or specialized education, such as a college or a university. A place of historical importance.

GeoEntity GeographicPole

Geyser Glacier

GolfCourse GovernmentStructure Heliport Hemisphere

HigherEducationFacility

HistoricalSite

402

EntityType

Description

Hospital

A building in which the sick or injured, especially those confined to bed, are medically treated. A place where hot water emerges from the ground. A large area covered with frozen water. An area of land set aside for aboriginal, tribal, or native populations. A [Structure] used for industrial or extractive purposes. A place where tourists and citizens can obtain information. The line running between geographic poles designated as the point where a calendar day begins. An area of land composed of the member [PoliticalUnit]s of an official governmental organization composed of two or more [Sovereign]s. An area of land completely surrounded by water and smaller than a [Continent]. A narrow strip of land connecting two larger landmasses and bordered by water on two sides. A place where two or more roads join. An inland water body, usually fresh water. A relatively small area of land exhibiting a common characteristic that distinguishes it from the surrounding land. A natural geographic feature on dry land. A [Structure] that is a well-known point of reference. An imaginary line of constant latitude that circles a [CelestialFeature], in which every point
403

HotSpring Ice IndigenousPeoplesReserve IndustrialStructure InformationCenter InternationalDateline

InternationalOrganization

Island Isthmus

Junction Lake LandArea

Landform LandmarkBuilding LatitudeLine

EntityType

Description

on the line is equidistant from a geographic pole. Library Lighthouse LinguisticRegion A place where books and other media are stored and loaned out to the public or others. A tall structure with a major navigation light. An area of land where most of the population speaks the same language or speaks languages in the same linguistic family. An imaginary line of constant longitude on a [CelestialFeature] that runs from one geographic pole to the other. A point on the surface of a [CelestialFeature] that is the origin for lines of magnetic force. A harbor facility for small boats. A place where goods are bought and sold. A [Structure] in which the sick or injured are medically treated. A place where urban rapid transit trains pick up and drop off passengers, often underground or elevated. A place used by an armed service for storing arms and supplies, for accommodating and training troops, and as a base from which operations can be initiated. A place where mineral ores are extracted from the ground by excavating surface pits and subterranean passages. A place characterized by dwellings, school, church, hospital, and other facilities operated by a religious group for the purpose of providing charitable services and to propagate religion. A commemorative structure or statue. A building for public Islamic worship.

LongitudeLine

MagneticPole Marina Market MedicalStructure MetroStation

MilitaryBase

Mine

Mission

Monument Mosque

404

EntityType

Description

Mountain MountainRange Museum

An elevated landform that rises, often steeply, above surrounding land on most sides. A group of connected [Mountain]s. A building where objects of permanent interest in one or more of the arts and sciences are preserved and exhibited. A [Structure] used for nautical purposes. A [Structure] used for navigational purposes. A section of a [PopulatedPlace], usually homogenous and/or well-known, but often with indistinct boundaries. An area in a [Desert] that contains water and plant life. A wildlife or scenic observation point. A vast expanse of salt water, one of the major [Sea]s covering part of the earth. A building that contains offices. An area maintained as a place of scenic beauty, or for recreation. A parking lot reserved for mass transit commuters. A break in a [MountainRange] used for transportation from one side of the mountain range to the other. An elongated area of land projecting into a body of water and surrounded by water on three sides. An extensive area of comparatively level to gently undulating land, lacking surface irregularities. A [CelestialFeature] that orbits a star. A section of a planetary crust that is in motion relative to other tectonic plates.
405

NauticalStructure NavigationalStructure Neighborhood

Oasis ObservationPoint Ocean OfficeBuilding Park ParkAndRide Pass

Peninsula

Plain

Planet Plate

EntityType

Description

Plateau PlayingField Pole

An elevated plain with steep slopes on one or more sides. A tract of land used for playing team sports and/or other athletic events. A point on the surface of a [CelestialFeature] that marks an important geographical or astronomical location. A building in which police are stationed or posted. An area of land with well-defined borders that is subject to a specific political administration. A concentrated area of human settlement, such as a city, a town, or a village. A district used by a postal service as an aid in postal distribution and having a unique identifying code. One of the set of lowest-level and most detailed set of [PostCode]s in a [Sovereign]. One of the set of second-order (one level up from the lowest level) [Postcode]s in a [Sovereign], composed by aggregating [Postcode1]s. One of the set of third-order [Postcode]s in a [Sovereign], composed by aggregating [Postcode2]s. One of the set of fourth-order [Postcode]s in a [Sovereign], composed by aggregating [Postcode3]s. A public building in which mail is received, sorted, and distributed. A facility for generating electric power. A facility for confining persons convicted or accused of crimes. A small, usually pointed [Peninsula] that often
406

PoliceStation PoliticalUnit PopulatedPlace Postcode

Postcode1 Postcode2

Postcode3

Postcode4

PostOffice PowerStation Prison Promontory

EntityType

Description

marks the terminus of a landmass. RaceTrack Railway RailwayStation A track where races are held. A permanent twin steel-rail track on which trains move. A place comprised of ticket offices, platforms, and other facilities for loading and unloading train passengers and freight. A [Structure] used for watching or participating in sports or other athletic activities. A partly submerged feature, usually of coral, that projects upward near the water's surface and can be a navigational hazard. A large area of land where a specific characteristic of the land or its people is relatively homogenous. An area of land where the population holds relatively homogenous religious practices. A structure where organized, public religious services are held. A [Structure] used for scientific purposes. A tract of public land set aside for restricted use or reserved for future use. A house, a hut, an apartment building, or another structure where people reside. A designated area, usually along a major highway, where motorists can stop to relax. A stream of running water. An open way with an improved surface for efficient transportation of vehicles. A road. A junction where two or more roads meet or cross at the same grade. A destroyed or decayed structure that is no
407

RecreationalStructure Reef

Region

ReligiousRegion ReligiousStructure ResearchStructure Reserve ResidentialStructure RestArea River Road RoadBlock RoadIntersection Ruin

EntityType

Description

longer functional. Satellite School ScientificResearchBase Sea SeaplaneLandingArea ShipWreck ShoppingCenter Shrine Site SkiArea Sovereign SpotElevation Spring Stadium StatisticalDistrict Structure A [CelestialFeature] that orbits a [Planet]. A place where people, usually children, receive a basic education. A scientific facility used as a base from which research is carried out or monitored. A large area of salt water. A place on a water body where floatplanes land and take off. A site of the remains of a wrecked vessel. A collection of linked retail establishments. A structure or place that memorializes a person or religious concept. A place most notable because of an event that occurred in that location. A place developed for recreational Alpine or Nordic skiing. An independent nation-state, the highest level of political authority in that location. A point on a [CelestialFeature]'s surface with a known elevation. A place where water emerges from the ground. A structure with an enclosure for athletic games with tiers of seats for spectators. An area of land defined as a district to be used for statistical collection or service provision. A building, a facility, or a group of buildings and/or facilities used for a certain common purpose. A line that forms the border between two [Plate]s. A [Landform] related to [Plate]s and their movement.
408

TectonicBoundary TectonicFeature

EntityType

Description

Temple TimeZone TouristStructure Trail TransportationStructure Tunnel UnderwaterFeature UrbanRegion Valley Volcano Wall Waterfall WaterFeature Well

An edifice dedicated to religious worship. A large area within which the same time standard is used. A [Structure] typically used by tourists. A path, a track, or a route used by pedestrians, animals, or off-road vehicles. A [Structure] used for transportation purposes. A subterranean passageway for transportation. A feature on the floor of a [WaterFeature]. An area of land with high population density and extensive urban development. A low area surrounded by higher ground on two or more sides. A [Mountain] formed by volcanic action and composed of volcanic rock. An upright structure that encloses, divides, or protects an area. A vertical or very steep section of a [River]. A geographic feature that has water on its surface. A cylindrical hole, pit, or tunnel drilled or dug down to a depth from which water, oil, or gas can be pumped or brought to the surface. An area of high soil moisture, partially or intermittently covered with shallow water. A zoological garden or park where wild animals are kept for exhibition.

Wetland Zoo

Supported Culture Codes


The following list shows the culture codes supported by the Bing Maps REST Services APIs.

409

For supported cultures, street names are localized to the local culture. For example, if you request a location in France, the street names are localized in French. For other localized data such as country names, the level of localization will vary for each culture. For example, there may not be a localized name for the "United States" for every culture code.
Culture Language Locations and Routes Imagery

af am ar-sa as az-Latn be bg bn-BD bn-IN bs ca ca-ES-valencia cs cy da de de-de el en-GB en-US es es-ES es-US

Afrikaans Amharic Arabic (Saudi Arabia) Assamese Azerbaijani (Latin) Belarusian Bulgarian Bangla (Bangladesh) Bangla (India) Bosnian (Latin) Catalan Spanish Valencian Czech Welsh Danish German (Germany) German (Germany) Greek English (United Kingdom) English (United States) Spanish (Spain) Spantish (Spain) Spanish (United States)

X X X X X X X X X X X X X X X X X** X X X X X** X
1

X**

410

Culture

Language

Locations and Routes

Imagery

es-MX et eu fa fi fil-Latn fr fr-FR fr-CA ga gd-Latn gl gu ha-Latn he hi hr hu hy id ig-Latn is it it-it ja ka kk km

Spanish (Mexico) Estonian Basque Persian Finnish Filipino French (France) French (France) French (Canada) Irish Scottish Gaelic Galician Gujarati Hausa (Latin) Hebrew Hindi Croatian Hungarian Armenian Indonesian Igbo Icelandic Italian (Italy) Italian (Italy) Japanese Georgian Kazakh Khmer X X X X X X X X X X X X X X X X X X X X X X X X

X** X
2

X**

411

Culture

Language

Locations and Routes

Imagery

kn ko kok ku-Arab ky-Cyrl lb lt lv mi-Latn mk ml mn-Cyrl mr ms mt nb ne nl nl-BE nn nso or pa pa-Arab pl prs-Arab pt-BR pt-PT

Kannada Korean Konkani Central Kurdish Kyrgyz Luxembourgish Lithuanian Latvian Maori Macedonian Malayalam Mongolian (Cyrillic) Marathi Malay (Malaysia) Maltese Norwegian (Bokml) Nepali (Nepal) Dutch (Netherlands) Dutch (Netherlands) Norwegian (Nynorsk) Sesotho sa Leboa Odia Punjabi (Gurmukhi) Punjabi (Arabic) Polish Dari Portuguese (Brazil) Portuguese (Portugal)

X X X X X X X X X X X X X X X X X X X** X X X X X X X X X
412

Culture

Language

Locations and Routes

Imagery

qut-Latn quz ro ru rw sd-Arab si sk sl sq sr-Cyrl-BA sr-Cyrl-RS sr-Latn-RS sv sw ta te tg-Cyrl th ti tk-Latn tn tr tt-Cyrl ug-Arab uk ur

Kiche Quechua (Peru) Romanian (Romania) Russian Kinyarwanda Sindhi (Arabic) Sinhala Slovak Slovenian Albanian Serbian (Cyrillic, Bosnia and Herzegovina) Serbian (Cyrillic, Serbia) Serbian (Latin, Serbia) Swedish (Sweden) Kiswahili Tamil Telugu Tajik (Cyrillic) Thai Tigrinya Turkmen (Latin) Setswana Turkish Tatar (Cyrillic) Uyghur Ukrainian Urdu

X X X X X X X X X X X X X X X X X X X X X X X X X X X

413

Culture

Language

Locations and Routes

Imagery

uz-Latn vi wo xh yo-Latn zh-Hans zh-Hant zh-Hant zu

Uzbek (Latin) Vietnamese Wolof isiXhosa Yoruba Chinese (Simplified) Chinese (Traditional) Chinese (Traditional) isiZulu

X X X X X X X X X

**The Imagery API renders tiles in United States English (en-US) for all locations on the Earth at all zoom levels. The following languages are rendered for all locations on the Earth at zoom levels 1-9, and for Europe locations at all zoom levels (1-21): fr-FR, de-DE, it-IT, es-ES, nl-BE.
1 2

When you specify es-MX or es-US in the request, the culture is converted to es-ES. When you specify fr-CA in the request, the culture is converted to fr-FR.

Common Response Description


The response to a Bing Maps REST Services URL request includes the status of the request and one or more resources that contain location, imagery, or route information. The resource information that is returned depends on the Bing Maps REST Services URL that is used and the parameter values that are provided with it. For example, a Locations API URL returns one or more Location resources that provide location information based on the values in the URL request. The following tables describe the common fields that are returned in the response to a Bing Maps REST Services URL request. For more information about specific resource content, see the API reference for the Locations, Imagery, and Routes APIs.

Response
The Response container for a request provides the following information.
JSON XML Type Description

statusCode

StatusCode

integer

The HTTP Status code for the request.


414

JSON

XML

Type

Description

statusDescription

StatusDescription

string

A description of the HTTP status code. A status code that offers additional information about authentication success or failure.

authenticationResultCode

AuthenticationResultCode

One of the following values: ValidCredentials InvalidCredentials CredentialsExpired NotAuthorized NoCredentials None

traceId

TraceId

string

A unique identifier for the request. A copyright notice. A URL that references a brand image to support contractual branding requirements. A collection of ResourceSet objects. A ResourceSet is a container of Resources returned by the request. For more information, see the ResourceSet section below. A collection of
415

copyright brandLogoUri

Copyright BrandLogoUri

string string

resourceSets

ResourceSets

collection

errorDetails

ErrorDetails

string[]

JSON

XML

Type

Description

error descriptions. For example, ErrorDetails can identify parameter values that are not valid or missing.

ResourceSet
The ResourceSet container provides the following information.
JSON XML Type Description

estimatedTotal

EstimatedTotal

long

An estimate of the total number of resources in the ResourceSet. A collection of one or more resources. The resources that are returned depend on the request. Information about resources is provided in the API reference for each Bing Maps REST Services API.

resources

Resources

collection

Examples
The following are examples JSON and XML responses.

JSON Response Example


{ "authenticationResultCode":"ValidCredentials", "brandLogoUri":"http:\/\/dev.virtualearth.net\/Branding\/logo_powered_by.png",

416

"copyright":"Copyright 2010 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.", "resourceSets":[ { "estimatedTotal":1, "resources":[ { Resource content specific to a REST service } ] } ], "statusCode":200, "statusDescription":null, "traceId":"961e9c1e63e64bd4aa7d140ee4e05697" }

XML Response Example


<Response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/search/local/ws/rest/v1"> <Copyright>Copyright 2010 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.</Copyright> <BrandLogoUri>http://dev.virtualearth.net/Branding/logo_powered_by.png</BrandLogoUri> <StatusCode>200</StatusCode> <AuthenticationResultCode>ValidCredentials</AuthenticationResultCode> <TraceId>25c368c85b964f4c978ff932b966a9d4</TraceId> <ResourceSets> <ResourceSet> <EstimatedTotal>1</EstimatedTotal> <Resources>

417

<Resource> <!-- Resource content specific to a REST service --> </Resource> </Resources> </ResourceSet> </ResourceSets> </Response>

JSON Data Contracts


The following data contracts include classes for all Bing Maps REST Services. For examples of how to use these data contracts, see Using the REST Services with .NET.

Data Contracts
C# Data Contracts
using System.Runtime.Serialization;

namespace BingMapsRESTService.Common.JSON { [DataContract] public class Address { [DataMember(Name = "addressLine", EmitDefaultValue = false)] public string AddressLine { get; set; }

[DataMember(Name = "adminDistrict", EmitDefaultValue = false)] public string AdminDistrict { get; set; }

[DataMember(Name = "adminDistrict2", EmitDefaultValue = false)] public string AdminDistrict2 { get; set; }

[DataMember(Name = "countryRegion", EmitDefaultValue = false)] public string CountryRegion { get; set; } 418

[DataMember(Name = "formattedAddress", EmitDefaultValue = false)] public string FormattedAddress { get; set; }

[DataMember(Name = "locality", EmitDefaultValue = false)] public string Locality { get; set; }

[DataMember(Name = "postalCode", EmitDefaultValue = false)] public string PostalCode { get; set; }

[DataMember(Name = "neighborhood", EmitDefaultValue = false)] public string Neighborhood { get; set; }

[DataMember(Name = "landmark", EmitDefaultValue = false)] public string Landmark { get; set; } }

[DataContract(Namespace = "http://schemas.microsoft.com/search/local/ws/rest/v1")] public class BirdseyeMetadata : ImageryMetadata { [DataMember(Name = "orientation", EmitDefaultValue = false)] public double Orientation { get; set; }

[DataMember(Name = "tilesX", EmitDefaultValue = false)] public int TilesX { get; set; }

[DataMember(Name = "tilesY", EmitDefaultValue = false)] public int TilesY { get; set; } }

[DataContract] public class BoundingBox { [DataMember(Name = "southLatitude", EmitDefaultValue = false)] 419

public double SouthLatitude { get; set; }

[DataMember(Name = "westLongitude", EmitDefaultValue = false)] public double WestLongitude { get; set; }

[DataMember(Name = "northLatitude", EmitDefaultValue = false)] public double NorthLatitude { get; set; }

[DataMember(Name = "eastLongitude", EmitDefaultValue = false)] public double EastLongitude { get; set; } }

[DataContract] public class Detail { [DataMember(Name = "compassDegrees", EmitDefaultValue = false)] public int CompassDegrees { get; set; }

[DataMember(Name = "maneuverType", EmitDefaultValue = false)] public string ManeuverType { get; set; }

[DataMember(Name = "startPathIndices", EmitDefaultValue = false)] public int[] StartPathIndices { get; set; }

[DataMember(Name = "endPathIndices", EmitDefaultValue = false)] public int[] EndPathIndices { get; set; }

[DataMember(Name = "roadType", EmitDefaultValue = false)] public string RoadType { get; set; }

[DataMember(Name = "locationCodes", EmitDefaultValue = false)] public string[] LocationCodes { get; set; }

[DataMember(Name = "names", EmitDefaultValue = false)] 420

public string[] Names { get; set; }

[DataMember(Name = "mode", EmitDefaultValue = false)] public string Mode { get; set; }

[DataMember(Name = "roadShieldRequestParameters", EmitDefaultValue = false)] public RoadShield roadShieldRequestParameters { get; set; } }

[DataContract] public class Generalization { [DataMember(Name = "pathIndices", EmitDefaultValue = false)] public int[] PathIndices { get; set; }

[DataMember(Name = "latLongTolerance", EmitDefaultValue = false)] public double LatLongTolerance { get; set; } }

[DataContract] public class Hint { [DataMember(Name = "hintType", EmitDefaultValue = false)] public string HintType { get; set; }

[DataMember(Name = "text", EmitDefaultValue = false)] public string Text { get; set; } }

[DataContract(Namespace = "http://schemas.microsoft.com/search/local/ws/rest/v1")] [KnownType(typeof(StaticMapMetadata))] [KnownType(typeof(BirdseyeMetadata))] public class ImageryMetadata : Resource { 421

[DataMember(Name = "imageHeight", EmitDefaultValue = false)] public string ImageHeight { get; set; }

[DataMember(Name = "imageWidth", EmitDefaultValue = false)] public string ImageWidth { get; set; }

[DataMember(Name = "imageUrl", EmitDefaultValue = false)] public string ImageUrl { get; set; }

[DataMember(Name = "imageUrlSubdomains", EmitDefaultValue = false)] public string[] ImageUrlSubdomains { get; set; }

[DataMember(Name = "vintageEnd", EmitDefaultValue = false)] public string VintageEnd { get; set; }

[DataMember(Name = "vintageStart", EmitDefaultValue = false)] public string VintageStart { get; set; }

[DataMember(Name = "zoomMax", EmitDefaultValue = false)] public int ZoomMax { get; set; }

[DataMember(Name = "zoomMin", EmitDefaultValue = false)] public int ZoomMin { get; set; } }

[DataContract] public class Instruction { [DataMember(Name = "maneuverType", EmitDefaultValue = false)] public string ManeuverType { get; set; }

[DataMember(Name = "text", EmitDefaultValue = false)] public string Text { get; set; } } 422

[DataContract] public class ItineraryItem { [DataMember(Name = "childItineraryItems", EmitDefaultValue = false)] public ItineraryItem ChildItineraryItems { get; set; }

[DataMember(Name = "compassDirection", EmitDefaultValue = false)] public string CompassDirection { get; set; }

[DataMember(Name = "details", EmitDefaultValue = false)] public Detail[] Details { get; set; }

[DataMember(Name = "exit", EmitDefaultValue = false)] public string Exit { get; set; }

[DataMember(Name = "hints", EmitDefaultValue = false)] public Hint[] Hints { get; set; }

[DataMember(Name = "iconType", EmitDefaultValue = false)] public string IconType { get; set; }

[DataMember(Name = "instruction", EmitDefaultValue = false)] public Instruction Instruction { get; set; }

[DataMember(Name = "maneuverPoint", EmitDefaultValue = false)] public Point ManeuverPoint { get; set; }

[DataMember(Name = "sideOfStreet", EmitDefaultValue = false)] public string SideOfStreet { get; set; }

[DataMember(Name = "signs", EmitDefaultValue = false)] public string[] Signs { get; set; }

423

[DataMember(Name = "time", EmitDefaultValue = false)] public string Time { get; set; }

[DataMember(Name = "tollZone", EmitDefaultValue = false)] public string TollZone { get; set; }

[DataMember(Name = "towardsRoadName", EmitDefaultValue = false)] public string TowardsRoadName { get; set; }

[DataMember(Name = "transitLine", EmitDefaultValue = false)] public TransitLine TransitLine { get; set; }

[DataMember(Name = "transitStopId", EmitDefaultValue = false)] public int TransitStopId { get; set; }

[DataMember(Name = "transitTerminus", EmitDefaultValue = false)] public string TransitTerminus { get; set; }

[DataMember(Name = "travelDistance", EmitDefaultValue = false)] public double TravelDistance { get; set; }

[DataMember(Name = "travelDuration", EmitDefaultValue = false)] public double TravelDuration { get; set; }

[DataMember(Name = "travelMode", EmitDefaultValue = false)] public string TravelMode { get; set; }

[DataMember(Name = "warning", EmitDefaultValue = false)] public Warning[] Warning { get; set; } }

[DataContract] public class Line { 424

[DataMember(Name = "type", EmitDefaultValue = false)] public string Type { get; set; }

[DataMember(Name = "coordinates", EmitDefaultValue = false)] public double[][] Coordinates { get; set; } }

[DataContract(Namespace = "http://schemas.microsoft.com/search/local/ws/rest/v1")] public class Location : Resource { [DataMember(Name = "name", EmitDefaultValue = false)] public string Name { get; set; }

[DataMember(Name = "point", EmitDefaultValue = false)] public Point Point { get; set; }

[DataMember(Name = "entityType", EmitDefaultValue = false)] public string EntityType { get; set; }

[DataMember(Name = "address", EmitDefaultValue = false)] public Address Address { get; set; }

[DataMember(Name = "confidence", EmitDefaultValue = false)] public string Confidence { get; set; }

[DataMember(Name = "matchCodes", EmitDefaultValue = false)] public string[] MatchCodes { get; set; }

[DataMember(Name = "geocodePoints", EmitDefaultValue = false)] public Point[] GeocodePoints { get; set; } }

[DataContract(Namespace = "http://schemas.microsoft.com/search/local/ws/rest/v1")] public class PinInfo 425

{ [DataMember(Name = "anchor", EmitDefaultValue = false)] public Pixel Anchor { get; set; }

[DataMember(Name = "bottomRightOffset", EmitDefaultValue = false)] public Pixel BottomRightOffset { get; set; }

[DataMember(Name = "topLeftOffset", EmitDefaultValue = false)] public Pixel TopLeftOffset { get; set; }

[DataMember(Name = "point", EmitDefaultValue = false)] public Point Point { get; set; } }

[DataContract(Namespace = "http://schemas.microsoft.com/search/local/ws/rest/v1")] public class Pixel { [DataMember(Name = "x", EmitDefaultValue = false)] public string X { get; set; }

[DataMember(Name = "y", EmitDefaultValue = false)] public string Y { get; set; } }

[DataContract] public class Point : Shape { [DataMember(Name = "type", EmitDefaultValue = false)] public string Type { get; set; }

/// <summary> /// Latitude,Longitude /// </summary> [DataMember(Name = "coordinates", EmitDefaultValue = false)] 426

public double[] Coordinates { get; set; }

[DataMember(Name = "calculationMethod", EmitDefaultValue = false)] public string CalculationMethod { get; set; }

[DataMember(Name = "usageTypes", EmitDefaultValue = false)] public string[] UsageTypes { get; set; } }

[DataContract] [KnownType(typeof(Location))] [KnownType(typeof(Route))] [KnownType(typeof(TrafficIncident))] [KnownType(typeof(ImageryMetadata))] [KnownType(typeof(ElevationData))] [KnownType(typeof(SeaLevelData))] [KnownType(typeof(CompressedPointList))] public class Resource { [DataMember(Name = "bbox", EmitDefaultValue = false)] public double[] BoundingBox { get; set; }

[DataMember(Name = "__type", EmitDefaultValue = false)] public string Type { get; set; } }

[DataContract] public class ResourceSet { [DataMember(Name = "estimatedTotal", EmitDefaultValue = false)] public long EstimatedTotal { get; set; }

[DataMember(Name = "resources", EmitDefaultValue = false)] public Resource[] Resources { get; set; } 427

[DataContract] public class Response { [DataMember(Name = "copyright", EmitDefaultValue = false)] public string Copyright { get; set; }

[DataMember(Name = "brandLogoUri", EmitDefaultValue = false)] public string BrandLogoUri { get; set; }

[DataMember(Name = "statusCode", EmitDefaultValue = false)] public int StatusCode { get; set; }

[DataMember(Name = "statusDescription", EmitDefaultValue = false)] public string StatusDescription { get; set; }

[DataMember(Name = "authenticationResultCode", EmitDefaultValue = false)] public string AuthenticationResultCode { get; set; }

[DataMember(Name = "errorDetails", EmitDefaultValue = false)] public string[] errorDetails { get; set; }

[DataMember(Name = "traceId", EmitDefaultValue = false)] public string TraceId { get; set; }

[DataMember(Name = "resourceSets", EmitDefaultValue = false)] public ResourceSet[] ResourceSets { get; set; } }

[DataContract] public class RoadShield { [DataMember(Name = "bucket", EmitDefaultValue = false)] 428

public int Bucket { get; set; }

[DataMember(Name = "shields", EmitDefaultValue = false)] public Shield[] Shields { get; set; } }

[DataContract(Namespace = "http://schemas.microsoft.com/search/local/ws/rest/v1")] public class Route : Resource { [DataMember(Name = "id", EmitDefaultValue = false)] public string Id { get; set; }

[DataMember(Name = "distanceUnit", EmitDefaultValue = false)] public string DistanceUnit { get; set; }

[DataMember(Name = "durationUnit", EmitDefaultValue = false)] public string DurationUnit { get; set; }

[DataMember(Name = "travelDistance", EmitDefaultValue = false)] public double TravelDistance { get; set; }

[DataMember(Name = "travelDuration", EmitDefaultValue = false)] public double TravelDuration { get; set; }

[DataMember(Name = "routeLegs", EmitDefaultValue = false)] public RouteLeg[] RouteLegs { get; set; }

[DataMember(Name = "routePath", EmitDefaultValue = false)] public RoutePath RoutePath { get; set; } }

[DataContract] public class RouteLeg { 429

[DataMember(Name = "travelDistance", EmitDefaultValue = false)] public double TravelDistance { get; set; }

[DataMember(Name = "travelDuration", EmitDefaultValue = false)] public double TravelDuration { get; set; }

[DataMember(Name = "actualStart", EmitDefaultValue = false)] public Point ActualStart { get; set; }

[DataMember(Name = "actualEnd", EmitDefaultValue = false)] public Point ActualEnd { get; set; }

[DataMember(Name = "startLocation", EmitDefaultValue = false)] public Location StartLocation { get; set; }

[DataMember(Name = "endLocation", EmitDefaultValue = false)] public Location EndLocation { get; set; }

[DataMember(Name = "itineraryItems", EmitDefaultValue = false)] public ItineraryItem[] ItineraryItems { get; set; } }

[DataContract] public class RoutePath { [DataMember(Name = "line", EmitDefaultValue = false)] public Line Line { get; set; }

[DataMember(Name = "generalizations", EmitDefaultValue = false)] public Generalization[] Generalizations { get; set; } }

[DataContract] [KnownType(typeof(Point))] 430

public class Shape { [DataMember(Name = "boundingBox", EmitDefaultValue = false)] public double[] BoundingBox { get; set; } }

[DataContract] public class Shield { [DataMember(Name = "labels", EmitDefaultValue = false)] public string[] Labels { get; set; }

[DataMember(Name = "roadShieldType", EmitDefaultValue = false)] public int RoadShieldType { get; set; } }

[DataContract(Namespace = "http://schemas.microsoft.com/search/local/ws/rest/v1")] public class StaticMapMetadata : ImageryMetadata { [DataMember(Name = "mapCenter", EmitDefaultValue = false)] public Point MapCenter { get; set; }

[DataMember(Name = "pushpins", EmitDefaultValue = false)] public PinInfo[] Pushpins { get; set; }

[DataMember(Name = "zoom", EmitDefaultValue = false)] public string Zoom { get; set; } }

[DataContract(Namespace = "http://schemas.microsoft.com/search/local/ws/rest/v1")] public class TrafficIncident : Resource { [DataMember(Name = "point", EmitDefaultValue = false)] public Point Point { get; set; } 431

[DataMember(Name = "congestion", EmitDefaultValue = false)] public string Congestion { get; set; }

[DataMember(Name = "description", EmitDefaultValue = false)] public string Description { get; set; }

[DataMember(Name = "detour", EmitDefaultValue = false)] public string Detour { get; set; }

[DataMember(Name = "start", EmitDefaultValue = false)] public string Start { get; set; }

[DataMember(Name = "end", EmitDefaultValue = false)] public string End { get; set; }

[DataMember(Name = "incidentId", EmitDefaultValue = false)] public long IncidentId { get; set; }

[DataMember(Name = "lane", EmitDefaultValue = false)] public string Lane { get; set; }

[DataMember(Name = "lastModified", EmitDefaultValue = false)] public string LastModified { get; set; }

[DataMember(Name = "roadClosed", EmitDefaultValue = false)] public bool RoadClosed { get; set; }

[DataMember(Name = "severity", EmitDefaultValue = false)] public int Severity { get; set; }

[DataMember(Name = "toPoint", EmitDefaultValue = false)] public Point ToPoint { get; set; }

432

[DataMember(Name = "locationCodes", EmitDefaultValue = false)] public string[] LocationCodes { get; set; }

[DataMember(Name = "type", EmitDefaultValue = false)] public int Type { get; set; }

[DataMember(Name = "verified", EmitDefaultValue = false)] public bool Verified { get; set; } }

[DataContract] public class TransitLine { [DataMember(Name = "verboseName", EmitDefaultValue = false)] public string verboseName { get; set; }

[DataMember(Name = "abbreviatedName", EmitDefaultValue = false)] public string abbreviatedName { get; set; }

[DataMember(Name = "agencyId", EmitDefaultValue = false)] public long AgencyId { get; set; }

[DataMember(Name = "agencyName", EmitDefaultValue = false)] public string agencyName { get; set; }

[DataMember(Name = "lineColor", EmitDefaultValue = false)] public long lineColor { get; set; }

[DataMember(Name = "lineTextColor", EmitDefaultValue = false)] public long lineTextColor { get; set; }

[DataMember(Name = "uri", EmitDefaultValue = false)] public string uri { get; set; }

433

[DataMember(Name = "phoneNumber", EmitDefaultValue = false)] public string phoneNumber { get; set; }

[DataMember(Name = "providerInfo", EmitDefaultValue = false)] public string providerInfo { get; set; } }

[DataContract] public class Warning { [DataMember(Name = "warningType", EmitDefaultValue = false)] public string WarningType { get; set; }

[DataMember(Name = "severity", EmitDefaultValue = false)] public string Severity { get; set; }

[DataMember(Name = "text", EmitDefaultValue = false)] public string Text { get; set; } }

[DataContract(Namespace = "http://schemas.microsoft.com/search/local/ws/rest/v1")] public class CompressedPointList : Resource { [DataMember(Name = "value", EmitDefaultValue = false)] public string Value { get; set; } }

[DataContract(Namespace = "http://schemas.microsoft.com/search/local/ws/rest/v1")] public class ElevationData : Resource { [DataMember(Name = "elevations", EmitDefaultValue = false)] public int[] Elevations { get; set; }

[DataMember(Name = "zoomLevel", EmitDefaultValue = false)] 434

public int ZoomLevel { get; set; } }

[DataContract(Namespace = "http://schemas.microsoft.com/search/local/ws/rest/v1")] public class SeaLevelData : Resource { [DataMember(Name = "offsets", EmitDefaultValue = false)] public int[] Offsets { get; set; }

[DataMember(Name = "zoomLevel", EmitDefaultValue = false)] public int ZoomLevel { get; set; } } }

Visual Basic Data Contracts


Imports System.Runtime.Serialization

Namespace BingMapsRESTService.Common.JSON <DataContract()> _ Public Class Address <DataMember(Name:="addressLine", EmitDefaultValue:=False)> _ Public Property AddressLine() As String

<DataMember(Name:="adminDistrict", EmitDefaultValue:=False)> _ Public Property AdminDistrict() As String

<DataMember(Name:="adminDistrict2", EmitDefaultValue:=False)> _ Public Property AdminDistrict2() As String

<DataMember(Name:="countryRegion", EmitDefaultValue:=False)> _ Public Property CountryRegion() As String

<DataMember(Name:="formattedAddress", EmitDefaultValue:=False)> _ Public Property FormattedAddress() As String 435

<DataMember(Name:="locality", EmitDefaultValue:=False)> _ Public Property Locality() As String

<DataMember(Name:="postalCode", EmitDefaultValue:=False)> _ Public Property PostalCode() As String

<DataMember(Name:="neighborhood", EmitDefaultValue:=False)> _ Public Property Neighborhood() As String

<DataMember(Name:="landmark", EmitDefaultValue:=False)> _ Public Property Landmark() As String End Class

<DataContract([Namespace]:="http://schemas.microsoft.com/search/local/ws/rest/v1")> _ Public Class BirdseyeMetadata Inherits ImageryMetadata <DataMember(Name:="orientation", EmitDefaultValue:=False)> _ Public Property Orientation() As Double

<DataMember(Name:="tilesX", EmitDefaultValue:=False)> _ Public Property TilesX() As Integer

<DataMember(Name:="tilesY", EmitDefaultValue:=False)> _ Public Property TilesY() As Integer End Class

<DataContract()> _ Public Class BoundingBox <DataMember(Name:="southLatitude", EmitDefaultValue:=False)> _ Public Property SouthLatitude() As Double

<DataMember(Name:="westLongitude", EmitDefaultValue:=False)> _ Public Property WestLongitude() As Double 436

<DataMember(Name:="northLatitude", EmitDefaultValue:=False)> _ Public Property NorthLatitude() As Double

<DataMember(Name:="eastLongitude", EmitDefaultValue:=False)> _ Public Property EastLongitude() As Double End Class

<DataContract()> _ Public Class Detail <DataMember(Name:="compassDegrees", EmitDefaultValue:=False)> _ Public Property CompassDegrees() As Integer

<DataMember(Name:="maneuverType", EmitDefaultValue:=False)> _ Public Property ManeuverType() As String

<DataMember(Name:="startPathIndices", EmitDefaultValue:=False)> _ Public Property StartPathIndices() As Integer()

<DataMember(Name:="endPathIndices", EmitDefaultValue:=False)> _ Public Property EndPathIndices() As Integer()

<DataMember(Name:="roadType", EmitDefaultValue:=False)> _ Public Property RoadType() As String

<DataMember(Name:="locationCodes", EmitDefaultValue:=False)> _ Public Property LocationCodes() As String()

<DataMember(Name:="names", EmitDefaultValue:=False)> _ Public Property Names() As String()

<DataMember(Name:="mode", EmitDefaultValue:=False)> _ Public Property Mode() As String

437

<DataMember(Name:="roadShieldRequestParameters", EmitDefaultValue:=False)> _ Public Property roadShieldRequestParameters() As RoadShield End Class

<DataContract()> _ Public Class Generalization <DataMember(Name:="pathIndices", EmitDefaultValue:=False)> _ Public Property PathIndices() As Integer()

<DataMember(Name:="latLongTolerance", EmitDefaultValue:=False)> _ Public Property LatLongTolerance() As Double End Class

<DataContract()> _ Public Class Hint <DataMember(Name:="hintType", EmitDefaultValue:=False)> _ Public Property HintType() As String

<DataMember(Name:="text", EmitDefaultValue:=False)> _ Public Property Text() As String End Class

<DataContract([Namespace]:="http://schemas.microsoft.com/search/local/ws/rest/v1")> _ <KnownType(GetType(StaticMapMetadata))> _ <KnownType(GetType(BirdseyeMetadata))> _ Public Class ImageryMetadata Inherits Resource <DataMember(Name:="imageHeight", EmitDefaultValue:=False)> _ Public Property ImageHeight() As String

<DataMember(Name:="imageWidth", EmitDefaultValue:=False)> _ Public Property ImageWidth() As String

<DataMember(Name:="imageUrl", EmitDefaultValue:=False)> _ 438

Public Property ImageUrl() As String

<DataMember(Name:="imageUrlSubdomains", EmitDefaultValue:=False)> _ Public Property ImageUrlSubdomains() As String()

<DataMember(Name:="vintageEnd", EmitDefaultValue:=False)> _ Public Property VintageEnd() As String

<DataMember(Name:="vintageStart", EmitDefaultValue:=False)> _ Public Property VintageStart() As String

<DataMember(Name:="zoomMax", EmitDefaultValue:=False)> _ Public Property ZoomMax() As Integer

<DataMember(Name:="zoomMin", EmitDefaultValue:=False)> _ Public Property ZoomMin() As Integer End Class

<DataContract()> _ Public Class Instruction <DataMember(Name:="maneuverType", EmitDefaultValue:=False)> _ Public Property ManeuverType() As String

<DataMember(Name:="text", EmitDefaultValue:=False)> _ Public Property Text() As String End Class

<DataContract()> _ Public Class ItineraryItem <DataMember(Name:="childItineraryItems", EmitDefaultValue:=False)> _ Public Property ChildItineraryItems() As ItineraryItem

<DataMember(Name:="compassDirection", EmitDefaultValue:=False)> _ Public Property CompassDirection() As String 439

<DataMember(Name:="details", EmitDefaultValue:=False)> _ Public Property Details() As Detail()

<DataMember(Name:="exit", EmitDefaultValue:=False)> _ Public Property [Exit]() As String

<DataMember(Name:="hints", EmitDefaultValue:=False)> _ Public Property Hints() As Hint()

<DataMember(Name:="iconType", EmitDefaultValue:=False)> _ Public Property IconType() As String

<DataMember(Name:="instruction", EmitDefaultValue:=False)> _ Public Property Instruction() As Instruction

<DataMember(Name:="maneuverPoint", EmitDefaultValue:=False)> _ Public Property ManeuverPoint() As Point

<DataMember(Name:="sideOfStreet", EmitDefaultValue:=False)> _ Public Property SideOfStreet() As String

<DataMember(Name:="signs", EmitDefaultValue:=False)> _ Public Property Signs() As String()

<DataMember(Name:="time", EmitDefaultValue:=False)> _ Public Property Time() As String

<DataMember(Name:="tollZone", EmitDefaultValue:=False)> _ Public Property TollZone() As String

<DataMember(Name:="towardsRoadName", EmitDefaultValue:=False)> _ Public Property TowardsRoadName() As String

440

<DataMember(Name:="transitLine", EmitDefaultValue:=False)> _ Public Property TransitLine() As TransitLine

<DataMember(Name:="transitStopId", EmitDefaultValue:=False)> _ Public Property TransitStopId() As Integer

<DataMember(Name:="transitTerminus", EmitDefaultValue:=False)> _ Public Property TransitTerminus() As String

<DataMember(Name:="travelDistance", EmitDefaultValue:=False)> _ Public Property TravelDistance() As Double

<DataMember(Name:="travelDuration", EmitDefaultValue:=False)> _ Public Property TravelDuration() As Double

<DataMember(Name:="travelMode", EmitDefaultValue:=False)> _ Public Property TravelMode() As String

<DataMember(Name:="warning", EmitDefaultValue:=False)> _ Public Property Warning() As Warning() End Class

<DataContract()> _ Public Class Line <DataMember(Name:="type", EmitDefaultValue:=False)> _ Public Property Type() As String

<DataMember(Name:="coordinates", EmitDefaultValue:=False)> _ Public Property Coordinates() As Double()() End Class

<DataContract([Namespace]:="http://schemas.microsoft.com/search/local/ws/rest/v1")> _ Public Class Location Inherits Resource 441

<DataMember(Name:="name", EmitDefaultValue:=False)> _ Public Property Name() As String

<DataMember(Name:="point", EmitDefaultValue:=False)> _ Public Property Point() As Point

<DataMember(Name:="entityType", EmitDefaultValue:=False)> _ Public Property EntityType() As String

<DataMember(Name:="address", EmitDefaultValue:=False)> _ Public Property Address() As Address

<DataMember(Name:="confidence", EmitDefaultValue:=False)> _ Public Property Confidence() As String

<DataMember(Name:="matchCodes", EmitDefaultValue:=False)> _ Public Property MatchCodes() As String()

<DataMember(Name:="geocodePoints", EmitDefaultValue:=False)> _ Public Property GeocodePoints() As Point() End Class

<DataContract([Namespace]:="http://schemas.microsoft.com/search/local/ws/rest/v1")> _ Public Class PinInfo <DataMember(Name:="anchor", EmitDefaultValue:=False)> _ Public Property Anchor() As Pixel

<DataMember(Name:="bottomRightOffset", EmitDefaultValue:=False)> _ Public Property BottomRightOffset() As Pixel

<DataMember(Name:="topLeftOffset", EmitDefaultValue:=False)> _ Public Property TopLeftOffset() As Pixel

<DataMember(Name:="point", EmitDefaultValue:=False)> _ 442

Public Property Point() As Point End Class

<DataContract([Namespace]:="http://schemas.microsoft.com/search/local/ws/rest/v1")> _ Public Class Pixel <DataMember(Name:="x", EmitDefaultValue:=False)> _ Public Property X() As String

<DataMember(Name:="y", EmitDefaultValue:=False)> _ Public Property Y() As String End Class

<DataContract()> _ Public Class Point Inherits Shape <DataMember(Name:="type", EmitDefaultValue:=False)> _ Public Property Type() As String

''' <summary> ''' Latitude,Longitude ''' </summary> <DataMember(Name:="coordinates", EmitDefaultValue:=False)> _ Public Property Coordinates() As Double()

<DataMember(Name:="calculationMethod", EmitDefaultValue:=False)> _ Public Property CalculationMethod() As String

<DataMember(Name:="usageTypes", EmitDefaultValue:=False)> _ Public Property UsageTypes() As String() End Class

<DataContract()> _ <KnownType(GetType(Location))> _ <KnownType(GetType(Route))> _ 443

<KnownType(GetType(TrafficIncident))> _ <KnownType(GetType(ImageryMetadata))> _ <KnownType(GetType(ElevationData))> _ <KnownType(GetType(SeaLevelData))> _ <KnownType(GetType(CompressedPointList))> _ Public Class Resource <DataMember(Name:="bbox", EmitDefaultValue:=False)> _ Public Property BoundingBox() As Double()

<DataMember(Name:="__type", EmitDefaultValue:=False)> _ Public Property Type() As String End Class

<DataContract()> _ Public Class ResourceSet <DataMember(Name:="estimatedTotal", EmitDefaultValue:=False)> _ Public Property EstimatedTotal() As Long

<DataMember(Name:="resources", EmitDefaultValue:=False)> _ Public Property Resources() As Resource() End Class

<DataContract()> _ Public Class Response <DataMember(Name:="copyright", EmitDefaultValue:=False)> _ Public Property Copyright() As String

<DataMember(Name:="brandLogoUri", EmitDefaultValue:=False)> _ Public Property BrandLogoUri() As String

<DataMember(Name:="statusCode", EmitDefaultValue:=False)> _ Public Property StatusCode() As Integer

<DataMember(Name:="statusDescription", EmitDefaultValue:=False)> _ 444

Public Property StatusDescription() As String

<DataMember(Name:="authenticationResultCode", EmitDefaultValue:=False)> _ Public Property AuthenticationResultCode() As String

<DataMember(Name:="errorDetails", EmitDefaultValue:=False)> _ Public Property errorDetails() As String()

<DataMember(Name:="traceId", EmitDefaultValue:=False)> _ Public Property TraceId() As String

<DataMember(Name:="resourceSets", EmitDefaultValue:=False)> _ Public Property ResourceSets() As ResourceSet() End Class

<DataContract()> _ Public Class RoadShield <DataMember(Name:="bucket", EmitDefaultValue:=False)> _ Public Property Bucket() As Integer

<DataMember(Name:="shields", EmitDefaultValue:=False)> _ Public Property Shields() As Shield() End Class

<DataContract([Namespace]:="http://schemas.microsoft.com/search/local/ws/rest/v1")> _ Public Class Route Inherits Resource <DataMember(Name:="id", EmitDefaultValue:=False)> _ Public Property Id() As String

<DataMember(Name:="distanceUnit", EmitDefaultValue:=False)> _ Public Property DistanceUnit() As String

<DataMember(Name:="durationUnit", EmitDefaultValue:=False)> _ 445

Public Property DurationUnit() As String

<DataMember(Name:="travelDistance", EmitDefaultValue:=False)> _ Public Property TravelDistance() As Double

<DataMember(Name:="travelDuration", EmitDefaultValue:=False)> _ Public Property TravelDuration() As Double

<DataMember(Name:="routeLegs", EmitDefaultValue:=False)> _ Public Property RouteLegs() As RouteLeg()

<DataMember(Name:="routePath", EmitDefaultValue:=False)> _ Public Property RoutePath() As RoutePath End Class

<DataContract()> _ Public Class RouteLeg <DataMember(Name:="travelDistance", EmitDefaultValue:=False)> _ Public Property TravelDistance() As Double

<DataMember(Name:="travelDuration", EmitDefaultValue:=False)> _ Public Property TravelDuration() As Double

<DataMember(Name:="actualStart", EmitDefaultValue:=False)> _ Public Property ActualStart() As Point

<DataMember(Name:="actualEnd", EmitDefaultValue:=False)> _ Public Property ActualEnd() As Point

<DataMember(Name:="startLocation", EmitDefaultValue:=False)> _ Public Property StartLocation() As Location

<DataMember(Name:="endLocation", EmitDefaultValue:=False)> _ Public Property EndLocation() As Location 446

<DataMember(Name:="itineraryItems", EmitDefaultValue:=False)> _ Public Property ItineraryItems() As ItineraryItem() End Class

<DataContract()> _ Public Class RoutePath <DataMember(Name:="line", EmitDefaultValue:=False)> _ Public Property Line() As Line

<DataMember(Name:="generalizations", EmitDefaultValue:=False)> _ Public Property Generalizations() As Generalization() End Class

<DataContract()> _ <KnownType(GetType(Point))> _ Public Class Shape <DataMember(Name:="boundingBox", EmitDefaultValue:=False)> _ Public Property BoundingBox() As Double() End Class

<DataContract()> _ Public Class Shield <DataMember(Name:="labels", EmitDefaultValue:=False)> _ Public Property Labels() As String()

<DataMember(Name:="roadShieldType", EmitDefaultValue:=False)> _ Public Property RoadShieldType() As Integer End Class

<DataContract([Namespace]:="http://schemas.microsoft.com/search/local/ws/rest/v1")> _ Public Class StaticMapMetadata Inherits ImageryMetadata <DataMember(Name:="mapCenter", EmitDefaultValue:=False)> _ 447

Public Property MapCenter() As Point

<DataMember(Name:="pushpins", EmitDefaultValue:=False)> _ Public Property Pushpins() As PinInfo()

<DataMember(Name:="zoom", EmitDefaultValue:=False)> _ Public Property Zoom() As String End Class

<DataContract([Namespace]:="http://schemas.microsoft.com/search/local/ws/rest/v1")> _ Public Class TrafficIncident Inherits Resource <DataMember(Name:="point", EmitDefaultValue:=False)> _ Public Property Point() As Point

<DataMember(Name:="congestion", EmitDefaultValue:=False)> _ Public Property Congestion() As String

<DataMember(Name:="description", EmitDefaultValue:=False)> _ Public Property Description() As String

<DataMember(Name:="detour", EmitDefaultValue:=False)> _ Public Property Detour() As String

<DataMember(Name:="start", EmitDefaultValue:=False)> _ Public Property Start() As String

<DataMember(Name:="end", EmitDefaultValue:=False)> _ Public Property [End]() As String

<DataMember(Name:="incidentId", EmitDefaultValue:=False)> _ Public Property IncidentId() As Long

<DataMember(Name:="lane", EmitDefaultValue:=False)> _ 448

Public Property Lane() As String

<DataMember(Name:="lastModified", EmitDefaultValue:=False)> _ Public Property LastModified() As String

<DataMember(Name:="roadClosed", EmitDefaultValue:=False)> _ Public Property RoadClosed() As Boolean

<DataMember(Name:="severity", EmitDefaultValue:=False)> _ Public Property Severity() As Integer

<DataMember(Name:="toPoint", EmitDefaultValue:=False)> _ Public Property ToPoint() As Point

<DataMember(Name:="locationCodes", EmitDefaultValue:=False)> _ Public Property LocationCodes() As String()

<DataMember(Name:="type", EmitDefaultValue:=False)> _ Public Property Type() As Integer

<DataMember(Name:="verified", EmitDefaultValue:=False)> _ Public Property Verified() As Boolean End Class

<DataContract()> _ Public Class TransitLine <DataMember(Name:="verboseName", EmitDefaultValue:=False)> _ Public Property verboseName() As String

<DataMember(Name:="abbreviatedName", EmitDefaultValue:=False)> _ Public Property abbreviatedName() As String

<DataMember(Name:="agencyId", EmitDefaultValue:=False)> _ Public Property AgencyId() As Long 449

<DataMember(Name:="agencyName", EmitDefaultValue:=False)> _ Public Property agencyName() As String

<DataMember(Name:="lineColor", EmitDefaultValue:=False)> _ Public Property lineColor() As Long

<DataMember(Name:="lineTextColor", EmitDefaultValue:=False)> _ Public Property lineTextColor() As Long

<DataMember(Name:="uri", EmitDefaultValue:=False)> _ Public Property uri() As String

<DataMember(Name:="phoneNumber", EmitDefaultValue:=False)> _ Public Property phoneNumber() As String

<DataMember(Name:="providerInfo", EmitDefaultValue:=False)> _ Public Property providerInfo() As String End Class

<DataContract()> _ Public Class Warning <DataMember(Name:="warningType", EmitDefaultValue:=False)> _ Public Property WarningType() As String

<DataMember(Name:="severity", EmitDefaultValue:=False)> _ Public Property Severity() As String

<DataMember(Name:="text", EmitDefaultValue:=False)> _ Public Property Text() As String End Class

<DataContract([Namespace]:="http://schemas.microsoft.com/search/local/ws/rest/v1")> _ Public Class CompressedPointList 450

Inherits Resource <DataMember(Name:="value", EmitDefaultValue:=False)> _ Public Property Value() As String End Class

<DataContract([Namespace]:="http://schemas.microsoft.com/search/local/ws/rest/v1")> _ Public Class ElevationData Inherits Resource <DataMember(Name:="elevations", EmitDefaultValue:=False)> _ Public Property Elevations() As Integer()

<DataMember(Name:="zoomLevel", EmitDefaultValue:=False)> _ Public Property ZoomLevel() As Integer End Class

<DataContract([Namespace]:="http://schemas.microsoft.com/search/local/ws/rest/v1")> _ Public Class SeaLevelData Inherits Resource <DataMember(Name:="offsets", EmitDefaultValue:=False)> _ Public Property Offsets() As Integer()

<DataMember(Name:="zoomLevel", EmitDefaultValue:=False)> _ Public Property ZoomLevel() As Integer End Class End Namespace

Status Codes and Error Handling


Each response to a request provides an HTTP status code. This article describes these codes.

HTTP Status Codes


The following table lists the most common HTTP status codes. Additional information may be provided with a specific request.

451

HTTP Status Code

Short Description

Details

200 201 202 400 401

OK Created Accepted Bad Request Unauthorized

The request is successful. A new resource is created. The request has been accepted for processing. The request contained an error. Access was denied. You may have entered your credentials incorrectly, or you might not have access to the requested resource or operation. The request is for something forbidden. Authorization will not help. The requested resource was not found. Your request could not be completed because there was a problem with the service. There's a problem with the service right now. Please try again later.

403

Forbidden

404 500

Not Found Internal Server Error

503

Service Unavailable

Error Handling
Responses that do not return results Occasionally, the servers processing service requests can be overloaded, and you may receive some responses that contain no results for queries that you would normally receive a result. To identify this situation, check the HTTP headers of the response. If the HTTP header X-MS-BMWS-INFO is set to 1, it is best to wait a few seconds and try again. This may happen occasionally for Basic or Trial Bing Maps Keys, and rarely for Enterprise Bing Maps Keys. If you are experiencing this behavior continually with an Enterprise Bing Maps Key, contact Bing Maps for Enterprise.

452

Developer Resources
Getting Help

Developer Resources
Connect with other Bing Maps developers on the Bing Maps Forum. Read the Bing Maps Blog

Account Issues
If you are having issues creating a Bing Maps Developer Account, getting a Bing Maps Key, or have an account access question, contact mpnet@microsoft.com.

Licensing Questions
If you are interested in finding out more about Bing Maps or have questions about licensing Bing Maps, you can request information at Contact Us: Bing Maps for Enterprise. From North, Central, and South America, you can also contact Bing Maps by calling (800) 426-9400, ext. 11315.

453

S-ar putea să vă placă și