Multimap Open API Web Services to Bing Maps

25
0 Migrating to Bing Maps From Multimap Open API Web Services

description

Multimap How-To

Transcript of Multimap Open API Web Services to Bing Maps

0

Migrating to Bing Maps

From Multimap Open API Web Services

Table of Contents

Introduction....................................................................................................................................................................... 1

Purpose of this Guide .................................................................................................................................................................... 1

Why Bing Maps? .............................................................................................................................................................................. 2

Service Comparison ........................................................................................................................................................................ 2

Suggested Migration Plan ........................................................................................................................................................... 3

Next Steps .......................................................................................................................................................................................... 3

Authentication .................................................................................................................................................................. 4

Multimap ............................................................................................................................................................................................ 4

Bing Maps .......................................................................................................................................................................................... 4

Mapping Examples ......................................................................................................................................................... 5

Maps ..................................................................................................................................................................................................... 5

Geocoding .......................................................................................................................................................................................... 8

Reverse Geocoding ......................................................................................................................................................................... 9

Adding a Pushpin ............................................................................................................................................................................ 9

Displaying Routes......................................................................................................................................................................... 11

Getting Directions for a Route ................................................................................................................................................ 12

Multimap Open API Web Service Migration Tables ....................................................................................... 14

Development Cycle ..................................................................................................................................................... 15

Bing Maps ....................................................................................................................................................................................... 15

Code and Response Listings .................................................................................................................................... 17

XML Response: Multimap Geocoding .................................................................................................................................. 17

XML Response: Bing Maps Geocoding ................................................................................................................................ 17

JSON Response: Bing Maps Geocoding .............................................................................................................................. 18

XML Response: Bing Maps Reverse Geocoding ............................................................................................................... 20

XML Response: Bing Maps Route Directions .................................................................................................................... 21

1

Introduction

As part of the Multimap Services end of service announcement, the Bing platform team has established a

program to deliver a set of resources and tools to help you migrate your Multimap Open API applications

to Bing Maps APIs before November 18, 2011. This Migration Guide, which provides a detailed

comparison between Multimap and Bing Maps, as well as best practices for your development processes.

As a Multimap Open API developer, the benefits of migrating your application to Bing Maps are

numerous. Over the coming months, we invite you to use these resources and to take advantage of other

opportunities we will make available to make your move efficient and straightforward. We are here to

help.

Purpose of this Guide

The Multimap Open API Web Services to Bing Maps Migration Guide is intended to support you in your

Bing Maps migration. This resource includes detailed comparisons between Multimap and Bing Maps,

with a primary focus on the Bing Maps REST API, as well as comparative code samples and suggestions

for how to migrate Multimap applications to utilize the most current versions of Bing Maps APIs. As you

read this document you should gain an understanding of the benefits of Bing Maps APIs and how to

leverage Bing Maps in your existing mapping applications.

IMPORTANT NOTE: Static vs. Dynamic Maps

As a Multimap Open API Web Services developer, your mapping applications are using static maps –

maps that are loaded into an application or web page as images and require new images to be loaded

any time the content or context of a map changes. This guide assumes that you will choose to migrate

your Multimap applications using static maps to an equivalent application using static maps delivered via

the Bing Maps REST Imagery API. The transition from the Multimap Open API AJAX control to the Bing

Maps AJAX control is covered in a separate guide also featured on the Multimap forum.

Bing Maps offers AJAX and Silverlight map controls that enable you to load dynamic maps into

applications using JavaScript or .NET. Dynamic maps can be manipulated onscreen by the user, as well as

programmatically from your code and provide significant functionality beyond the capabilities of static

maps. If you are interested in exploring the option of using dynamic maps within your new Bing

applications, please visit the MSDN Bing Maps AJAX control documentation for more information.

2

Why Bing Maps?

Bing Maps offers numerous advantages over Multimap Web Services, including:

Enhanced geocoding and address parsing functionality for more accurate results.

Cleaner road map imagery and more complete road data.

High resolution imagery available in Aerial and Birdseye views.

Faster performance delivered through Bing cloud-based services.

A cleaner, more modern, programming model.

Service Comparison

The Multimap Open API Web Services have equivalents in the Bing Maps REST API. The following chart

shows a high level comparison of these services.

Multimap Open API Web Services Bing Maps API

Geocoding Service Locations API

Static Maps Imagery API

Routing Service Routes API

Improved Performance and Greater Flexibility

The Multimap Open API Web Services are REST based services that enable you to add location-based

functionality to your applications, including geocoding, routing, imagery, and spatial searching

capabilities. All responses from the Multimap Web Services are represented in XML.

The Bing Maps REST API is the recommend migration path from Multimap Web Services (if you wish to

continue using only static maps). The Bing Maps REST API is capable of returning responses in JSON or

XML format. JSON responses are generally easier to process in JavaScript than XML.

Adding to the improved performance of the Bing Maps REST API is the fact that Bing services and content

are hosted in Microsoft’s CDN and Dynamic Compute centers. This enables end users to access services

and content from datacenters closest to their location for lower latency and faster responses while

simultaneously increasing stability and scalability.

3

Universal API Access

Multimap consists of two different APIs: the Multimap Open API and the full Multimap API. Typically, the

Multimap API is used by customers on contract with Multimap while the Open API is used by all other

developers who want to use Multimap services. The Multimap API has additional tools and functionality

that are not available in the Open API, which limits what developers without contracts can do with

Multimap.

In Bing Maps, all customers have access to the same services and APIs; the type of account (e.g.,

developer, enterprise, etc.) is determined by the Bing Maps Key. All Bing Maps users have access to the

same set of tools and have transactions recorded against their accounts as per their respective licensing

terms. Users can easily switch between developer and production accounts by changing which key is used,

or even updating their existing key’s type, without changing the API or environment used by the

application. See Getting a Bing Maps Key on MSDN for more details on how to create a Bing Maps

Developer Account and obtain a Bing Maps Key.

Suggested Migration Plan

To assist you with planning, we have compiled this list of high-level steps to use as a baseline plan to

move your codebase and development practices to Bing Maps equivalents. While your ultimate plan will

depend on your specific situation, the following steps outline suggested components of any effort:

1. Create a Bing Maps account at the Bing Maps Account Center. You can find more information

about creating a Bing Maps account in the Development Cycle section of this Migration Guide.

2. Generate a Bing Maps key. When creating this key, set the “key type” to “developer” and set its

associated URL to the URL of your application.

a. We invite you to use the “developer” key type and free use terms outlined in the Bing Maps

Terms of Use (TOU). Production applications outside the free use thresholds in the TOU will

need a Bing Maps Enterprise account. For assistance with Bing Maps licensing, please

contact [email protected] (including your Bing Maps Account Center ID).

3. Test your migrated application.

4. Deploy your application to your production environment.

Next Steps

The remaining sections of this migration guide provide sample code that introduces you to the basics of

how to leverage the most commonly used Multimap Open API Web Services functionality using Bing

Maps REST APIs. You will also find discussions on the differences in the general development cycle and

authentication between the two platforms.

4

Authentication

This section of the migration guide discusses the differences in authentication methods between the

Multimap Open API Web Services and the Bing Maps REST API. The main difference between these

services is that the Multimap Open API Web Services use an API key for authentication, while the Bing

Maps REST API uses a Bing Maps key.

Multimap

Multimap Open API uses an API key for authentication. In order to access the Multimap REST Services,

you must specify the Multimap API key, as shown in Listing 1.

http://developer.multimap.com/API/geocode/1.2/[api_key]?qs=EC4A 2DY&city=London&countryCode=GB

Listing 1 Using Multimap Open API Web Services to geocode a location

Bing Maps

In the Bing Maps REST API, a Bing Maps key must be passed with each request as a parameter to the URL.

In the URL shown in Listing 2, replace BingMapsKey with your application key.

http://dev.virtualearth.net/REST/v1/Locations/query?key=BingMapsKey

Listing 2 Using a Bing Maps key to access the Bing Maps REST Locations API

More information on obtaining a Bing Maps Key can be found at Getting a Bing Maps Key.

5

Mapping Examples

This section provides descriptions and examples of how to migrate your Multimap Open API Web Services

applications to use the Bing Maps REST API. All of the major functionality in Multimap Open API Web

Services has equivalent functionality in Bing Maps, and indeed many features have been significantly

improved or enhanced. However, before going into great detail about any particular functionality, it is

worth looking at some basic examples that demonstrate Bing Maps equivalents for the most commonly

used mapping functionality in Multimap Open API Web Services.

This section of the migration guide shows Bing Maps equivalents for the following Multimap functions:

1. Generating a Static Map

2. Geocoding (by address)

3. Reverse geocoding

4. Adding pushpins on a map

5. Displaying a route on a map

6. Getting directions for a route

All Bing Maps examples in this article use the Bing Maps REST API. To read a discussion of the differences

between Multimap Web Services and the Bing Maps REST API, see the Service Comparison section of this

Guide.

Maps

The most basic function of any mapping API is loading or generating a static map. The following examples

demonstrate how to generate a static map image for the given locations.

Before: In Multimap

The URL in Listing 3 retrieves a static map for an address using Multimap Web Services.

http://developer.multimap.com/API/map/1.2/[api_key]?qs=Seattle, WA&countryCode=US&zoomFactor=10

Listing 3 Using Multimap Open API Web Services to obtain a static map

6

Figure 1 Multimap static map

After: In Bing Maps

Using the Bing Maps REST API, you can retrieve a static map image with a single request to the Imagery

API. For example, the URL in Listing 4 will retrieve the map shown in Figure 2.

http://dev.virtualearth.net/REST/v1/Imagery/Map/Road/Seattle,WA?mapVersion=v1&key=BingMapsKey

Listing 4 Sample Bing Maps REST URL for obtaining a static map

Figure 2 Static map of Seattle obtained from Bing Maps REST Imagery API

7

The mapVersion=v1 parameter shown in Listing 4 requests the map image version in Figure 2. These new

map images will become the default in the future.

Note that if you want to produce a map without a pushpin, you can specify the latitude, longitude, and

zoom level in your request instead of a named location, as shown in Listing 5.

http://dev.virtualearth.net/REST/v1/Imagery/Map/Road/47.619048,-122.35384/15?mapVersion=v1&key=BingMapsKey

Listing 5 Bing Maps REST URL to obtain a static map without a pushpin

Bing Maps has alternate map imagery sets such as Aerial or AerialWithLabels that be selected with the

imagerySet parameter. The example URL in Listing 6 displays a map using the imagery set

AerialWithLabels as seen in Figure 3.

http://dev.virtualearth.net/REST/v1/Imagery/Map/AerialWithLabels/47.60358,-122.329454/10?mapVersion=v1&key=BingMapsKey

Listing 6 Bing Maps REST URL to obtain an AerialWithLabels static map

Figure 3 Static map of Seattle obtained from Bing Maps REST Imagery API using AerialWithLabels

For more information on the full capabilities of the Bing Maps REST Imagery API, see

http://msdn.microsoft.com/en-us/library/ff701721.aspx.

8

Note: Authentication

Multimap: The Multimap example code in this article assumes that you already have a Multimap API key,

and any instance of [api_key] in a code sample should be replaced by your API key.

Bing Maps: Authentication in Bing Maps requires a Bing Maps key. For any of the Bing Maps REST

examples in this article, replace BingMapsKey in the URL with your Bing Maps key.

Geocoding

Geocoding is the process of determining a specific latitude and longitude for a street address or other

geographic feature. The following examples highlight the differences in geocoding syntax between

Multimap and the Bing Maps API for a formatted address.

Before: In Multimap

Listing 7 shows a simple example of a URL that requests latitude and longitude coordinates from the

Multimap Web Services by performing a 'quick search' for the postcode “EC4A 2DY” in London, Great

Britain.

http://developer.multimap.com/API/geocode/1.2/[api_key]?qs=1 Microsoft Way, Redmond, WA, 98052&countryCode=US

Listing 7 Using Multimap Open API Web Services to geocode a location

The response returned by this request can be found in Listing 18.

After: In Bing Maps

Geocoding with Bing Maps is performed using the Bing Maps Locations API which returns latitude,

longitude, and other information.

The request in Listing 8 shows how to geocode an address using a Bing Maps Locations API query.

http://dev.virtualearth.net/REST/v1/Locations/1 Microsoft Way, Redmond, WA 98052?key=BingMapsKey

Listing 8 Geocoding by address using the Bing Maps REST Locations API

The Locations API provides multiple URL templates for geocoding a location. In addition to the query

shown in Listing 8, there are structured and unstructured URL templates for geocoding an address. The

request in Listing 9 shows how to geocode an address using a structured URL. The format of the

structured URL varies by country.

http://dev.virtualearth.net/REST/v1/Locations/US/WA/98052/Redmond/1 Microsoft Way?o=xml&key=BingMapsKey

Listing 9 Geocoding by structured URL using the Bing Maps REST Locations API

9

The request in Listing 10 shows how to geocode the same address as an unstructured URL that specifies

the address with parameters.

http://dev.virtualearth.net/REST/v1/Locations?CountryRegion=US&adminDistrict=WA&postalCode=98052&locality=Redmond&addressLine=1 Microsoft Way&o=xml&key=BingMapsKey

Listing 10 Geocoding by unstructured URL using the Bing Maps REST Locations API

For more information on Locations URL templates, see the Locations API documentation.

By default, geocode results returned from the Bing Maps REST Locations API will be in JSON format. You

can also retrieve XML format results by specifying o=xml in the URL parameters. The response returned

by the request in Listing 8 can be found in Listing 20.

For more information on JSON deserialization, see http://msdn.microsoft.com/en-

us/library/bb412179.aspx.

Reverse Geocoding

Reverse geocoding allows you to search for an address or place by specifying latitude and longitude

coordinates.

In Bing Maps, the Locations API contains information about points, addresses, places, or other locations

for reverse geocoding. The following request returns Location information for the given latitude and

longitude:

http://dev.virtualearth.net/REST/v1/Locations/47.64054,-122.12934?o=xml&key=BingMapsKey

Listing 11 Bing Maps URL to reverse geocode by coordinates

The response returned by the request in Listing 11 can be found in Listing 21.

Adding a Pushpin

Both Multimap Open API Web Services and the Bing Maps REST API allow you to generate a static map

with one or more pushpins on it. Pushpins are used to mark specific locations on a map.

Before: In Multimap

The URL in Listing 12 uses the Multimap REST Services to generate a map with a pushpin centered on

Boston, MA.

http://developer.multimap.com/API/map/1.2/[api_key]?marker=myicon.png&label=hi&opacity=0.5&street=1%20Tremont%20Street&city=Boston&countryCode=US&width=350&height=350

Listing 12 Multimap map with pushpin URL

10

Figure 4 Multimap map displaying a pushpin

After: In Bing Maps

Big Maps does not support the use of addresses to specify a pushpin. Instead, latitude and longitude

coordinates are required, as shown in Listing 13 and Figure 5.

http://dev.virtualearth.net/REST/v1/Imagery/Map/Road/42.368,-71.065/15?mapVersion=v1&pushpin=42.368,-71.065;4;hi&key=BingMapsKey

Listing 13 Bing Maps map with pushpin URL

Figure 5 Bing Maps map displaying a pushpin

11

Note that, with Bing Maps, the map center and the pushpin coordinates must be specified separately.

Also, you must choose from a pre-defined selection of pushpins. Custom pushpin images will be

supported in a future version of the Bing Maps REST API.

Displaying Routes

Displaying a trip route between two or more points is one of the most common uses for online mapping

services. Bing Maps provides services for displaying routes for both driving and walking. The following

examples demonstrate how to create static maps with highlighted routes between multiple locations. The

routes are specified by defining a series of waypoints that specify geographical locations.

Before: In Multimap

The URL in Listing 14 generates a static map containing a route between two points, indicated by latitude

and longitude coordinates.

http://developer.multimap.com/API/map/1.2/[api_key]?routeKey=DC,-122.329454:47.60358;-122.130994:47.67856,0

Listing 14 Multimap URL for obtaining a map with a route

Figure 6 Multimap map displaying a route

Note: Multimap Open API Web Services do not support generating static maps for route based on

addresses. Instead, you must provide latitude and longitude coordinates.

12

After: In Bing Maps

Bing Maps provides support for routing using waypoints. Waypoints are specified by the waypoint

parameter which can be abbreviated as wp. Additionally, you can specify how the route will be optimized.

In the example in Listing 15, the route is optimized for shortest distance.

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

Listing 15 Bing Maps REST URL for obtaining a map with a route

Figure 7 Bing Maps map displaying a route

Getting Directions for a Route

The following examples demonstrate retrieving turn by turn directions for a route. The individual steps in

a route are described in terms of geographical location, instructions about how and when to turn, and

other informational notes. This example generates route directions between two cities.

Before: In Multimap

http://developer.multimap.com/API/route/1.2/[api_key]?qs_1=NW95LL&countryCode_1=GB&qs_2=EC4A2DY&countryCode_2=GB&qs_3=EN54BE&countryCode_3=GB

Listing 16 Multimap URL for obtaining route directions

13

After: In Bing Maps

The equivalent code using the Bing Maps REST Routes API is shown in Listing 17. Waypoints are included

as parameters in the request URL as wp.0 and wp.1. To add more waypoints, increment the number after

the wp parameter. In Listing 17, wp.2 would be the next incremental waypoint.

http://dev.virtualearth.net/REST/V1/Routes/Driving?wp.0=NW9 5LL&wp.1=EC4 A2D &optmz=distance&output=xml&key=BingMapsKey

Listing 17 Bing Maps REST URL for obtaining route directions

The response for the request in Listing 17 can be seen in Listing 22.

By default, the mode of travel for the route is assumed to be driving; walking instructions are also

available by specifying the optional travelMode parameter. For more information, see the Routes API

documentation.

14

Multimap Open API Web Service Migration Tables

The table below shows the equivalent Bing Maps AJAX API and REST API calls for all of the most used

Multimap Open API Web Services. You can click on any of the linked Multimap Open API Web Services to

navigate to the section of this migration guide that discusses that method and its Bing Maps equivalent.

You can click on any of the Bing Maps methods to be taken to the web-based MSDN documentation on

that method.

Multimap

Functionality

Multimap Method Bing Maps REST API

Static Map /API/map /Imagery/Map

Static Routes /API/map /Imagery/Map

Directions /API/route /Routes

Geocoding /API/geocode /Locations, /Dataflows/Geocode

Reverse

Geocoding

N/A /Locations

Pushpins /API/map /Imagery/Map

15

Development Cycle

This section of the migration guide highlights the overall application development cycle for the Bing Maps

REST APIs. The goal of this section is to demonstrate how you, as a developer, will need to modify (and in

most cases simplify) your application design practices during and after upgrading to Bing Maps.

Bing Maps

The best approach for developing with Bing Maps is to generate two Bing Maps keys for any application

being developed: one for the development environment and one for the production environment. When

moving between one environment and another, all you need to change is the Bing Maps key that you use

to access the services from your code. This method ensures that your applications will run with identical

behavior in staging and production (NOTE: those using Bing Maps under free use terms may find this

guideline unnecessary – it is more applicable to customers with and Enterprise license who have rights to

create keys of type “Enterprise”).

Prior to upgrading a Multimap Open API Web Services application or starting development on a new Bing

Maps application, you should generate a Bing Maps key using the Bing Maps Account Center

(http://www.bingmapsportal.com/). A Bing Maps key must be registered against a particular domain.

By default, each Bing Maps account is limited to five (5) Bing Maps keys.

16

Figure 8 Bing Maps Account Center

Useful Links

Bing Maps Portal (account setup, reporting and key management)

http://www.bingmapsportal.com/

Getting a Bing Maps Key

http://msdn.microsoft.com/en-us/library/ff428642.aspx

17

Code and Response Listings

This section contains equivalent code listings in VB.NET, Java, and PHP for all the C# listings throughout

this Guide.

XML Response: Multimap Geocoding

The URL in Listing 7 returns the XML response in Listing 18.

<?xml version="1.0" encoding="UTF-8"?> <Results xmlns="http://clients.multimap.com/API" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://clients.multimap.com/API http://clients.multimap.com/Schema/geocode_1.2.xsd" locationCount="1"> <Location geocodeQuality="2ci" geocodeScore="1.000" zoomFactor="17"> <Address> <Street>1 Microsoft Way</Street> <Areas> <Area>Redmond</Area> </Areas> <State>WA</State> <PostalCode>98052-8300</PostalCode> <DisplayName>1 Microsoft Way, Redmond, WA 98052-8300</DisplayName> <CountryCode>US</CountryCode> </Address> <Point> <Lat>47.63975</Lat> <Lon>-122.12973</Lon> </Point> </Location> </Results>

Listing 18 XML Response from Multimap REST Geocoding request

XML Response: Bing Maps Geocoding

The URL in Listing 8 returns the XML response in Listing 19.

<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>

18

<TraceId>5d62e8b30135423f8b1b0db5c2a53b55|EWRM001657|02.00.147.700|EWRMSNVM001816</TraceId> <ResourceSets> <ResourceSet> <EstimatedTotal>1</EstimatedTotal> <Resources> <Location> <Name>1 Microsoft Way, Redmond, WA 98052-8300</Name> <Point> <Latitude>47.639747</Latitude> <Longitude>-122.129731</Longitude> </Point> <BoundingBox> <SouthLatitude>47.635884282429323</SouthLatitude> <WestLongitude>-122.13737419709076</WestLongitude> <NorthLatitude>47.643609717570676</NorthLatitude> <EastLongitude>-122.12208780290925</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-8300</FormattedAddress> <Locality>Redmond</Locality> <PostalCode>98052-8300</PostalCode> </Address> <Confidence>High</Confidence> </Location> </Resources> </ResourceSet> </ResourceSets> </Response>

Listing 19 XML Response from Bing Maps REST Geocoding request

JSON Response: Bing Maps Geocoding

As noted previously, by excluding the parameter “output=xml” (short form: “o=x”), the URL in Listing 8

returns the JSON response in Listing 20.

{ "authenticationResultCode":"ValidCredentials","brandLogoUri":"http:\/\/dev.virtualearth.net\/Branding\ /logo_powered_by.png","copyright":"Copyright © 2010 Microsoft and its suppliers. All rights reserved. This API

19

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.635884282429323, -122.13737419709076, 47.643609717570676, -122.12208780290925 ], "name":"1 Microsoft Way, Redmond, WA 98052-8300", "point":{ "type":"Point", "coordinates":[ 47.639747, -122.129731 ] }, "address":{ "addressLine":"1 Microsoft Way", "adminDistrict":"WA", "adminDistrict2":"King County", "countryRegion":"United States", "formattedAddress":"1 Microsoft Way, Redmond, WA 98052-8300", "locality":"Redmond", "postalCode":"98052-8300" }, "confidence":"High", "entityType":"Address" } ] } ], "statusCode":200, "statusDescription":"OK", "traceId":"9ff2190c0a88428395c426abaa8cea34" }

Listing 20 JSON Response from Bing Maps REST Geocoding request

20

XML Response: Bing Maps Reverse Geocoding

The URL in Listing 11 returns the XML response in Listing 21.

<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>fbfb8df89423415589eec14c8de7585e</TraceId> <ResourceSets> <ResourceSet> <EstimatedTotal>2</EstimatedTotal> <Resources> <Location> <Name>1 Microsoft Way, Redmond, Washington 98052, United States</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>Washington</AdminDistrict> <AdminDistrict2>King</AdminDistrict2> <CountryRegion>United States</CountryRegion> <FormattedAddress>1 Microsoft Way, Redmond, Washington 98052, United States</FormattedAddress> <Locality>Redmond</Locality> <PostalCode>98052</PostalCode> </Address> <Confidence>Medium</Confidence> </Location>

21

<Location> <Name>1 Microsoft Way, Redmond, WA 98052 6399</Name> <Point> <Latitude>47.639747</Latitude> <Longitude>-122.129731</Longitude> </Point> <BoundingBox> <SouthLatitude>47.635884282429323</SouthLatitude> <WestLongitude>-122.13737419709076</WestLongitude> <NorthLatitude>47.643609717570676</NorthLatitude> <EastLongitude>-122.12208780290925</EastLongitude> </BoundingBox> <EntityType>Address</EntityType> <Address> <AddressLine>1 Microsoft Way</AddressLine> <AdminDistrict>WA</AdminDistrict> <AdminDistrict2>King County</AdminDistrict2> <CountryRegion>United States</CountryRegion> <FormattedAddress>1 Microsoft Way, Redmond, WA 98052 6399</FormattedAddress> <Locality>Redmond</Locality> <PostalCode>98052 6399</PostalCode> </Address> <Confidence>Medium</Confidence> </Location> </Resources> </ResourceSet> </ResourceSets> </Response>

Listing 21 XML Response from Bing Maps REST Reverse Geocoding request

XML Response: Bing Maps Route Directions

The URL in Listing 15 returns the XML response in Listing 22. Part of the response has been removed for

brevity.

<?xml version="1.0" encoding="utf-8"?> <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>

22

<TraceId>d9d1bf25446e4c52aea79e9a87d2bc9e|EWRM001652|02.00.58.600|EWRMSNVM001803, EWRMSNVM001702, EWRMSNVM001744, EWRMSNVM001701, EWRMSNVM001725, EWRMSNVM001808, EWRMSNVM001726, EWRMSNVM001743</TraceId> <ResourceSets> <ResourceSet> <EstimatedTotal>1</EstimatedTotal> <Resources> <Route> <Id>v60,i0,a0,cen-US,dAAAAAAAAAAA=,y0,s1,m1,o2,t4,wVCmWBI2U+v8=~pl3oNqG9eQEAAA4BXzIMPwI=~Tlc5IDVMTCwgQmFybmV0LCBVbml0ZWQgS2luZ2RvbQ==~~~,wZDqUBPGf/f8=~pl3oNknLfwEAAA4BpeD7PgA=~RUM0~~~,k1</Id> <BoundingBox> <SouthLatitude>51.513929665088654</SouthLatitude> <WestLongitude>-0.24284720420837402</WestLongitude> <NorthLatitude>51.599269509315491</NorthLatitude> <EastLongitude>-0.10438017547130585</EastLongitude> </BoundingBox> <DistanceUnit>Kilometer</DistanceUnit> <DurationUnit>Second</DurationUnit> <TravelDistance>15.492</TravelDistance> <TravelDuration>2333</TravelDuration> <RouteLeg> <TravelDistance>15.492</TravelDistance> <TravelDuration>2333</TravelDuration> <ActualStart> <Latitude>51.599269509315491</Latitude> <Longitude>-0.23971974849700928</Longitude> </ActualStart> <ActualEnd> <Latitude>51.513929665088654</Latitude> <Longitude>-0.10438017547130585</Longitude> </ActualEnd> <StartLocation> <Name>NW9 5LL, Barnet, United Kingdom</Name> <Point> <Latitude>51.598891317844391</Latitude> <Longitude>-0.23817144334316254</Longitude> </Point> <BoundingBox> <SouthLatitude>51.595028600273714</SouthLatitude> <WestLongitude>-0.24646210546060632</WestLongitude> <NorthLatitude>51.602754035415067</NorthLatitude> <EastLongitude>-0.22988078122571876</EastLongitude> </BoundingBox> <EntityType>Postcode1</EntityType> <Address> <AdminDistrict>England</AdminDistrict> <AdminDistrict2>Barnet</AdminDistrict2> <CountryRegion>United Kingdom</CountryRegion>

23

<FormattedAddress>NW9 5LL, Barnet, United Kingdom</FormattedAddress> <PostalCode>NW9 5LL</PostalCode> </Address> <Confidence>High</Confidence> </StartLocation> <EndLocation> <Name>EC4</Name> <Point> <Latitude>51.51393</Latitude> <Longitude>-0.10438</Longitude> </Point> <BoundingBox> <SouthLatitude>51.484959617007448</SouthLatitude> <WestLongitude>-0.16640977249525468</WestLongitude> <NorthLatitude>51.542900382992556</NorthLatitude> <EastLongitude>-0.042350227504745319</EastLongitude> </BoundingBox> <EntityType>PopulatedPlace</EntityType> <Address> <AdminDistrict>England</AdminDistrict> <AdminDistrict2>City of London</AdminDistrict2> <CountryRegion>United Kingdom</CountryRegion> <FormattedAddress>EC4</FormattedAddress> <Locality>EC4</Locality> </Address> <Confidence>High</Confidence> </EndLocation> <!-- Removed --> <ItineraryItem> <TravelMode>Driving</TravelMode> <TravelDistance>0</TravelDistance> <TravelDuration>0</TravelDuration> <ManeuverPoint> <Latitude>51.513929665088654</Latitude> <Longitude>-0.10438017547130585</Longitude> </ManeuverPoint> <Instruction maneuverType="ArriveFinish">Arrive at EC4</Instruction> <CompassDirection>south</CompassDirection> <Hint hintType="NextIntersection">If you reach Bride Court, you've gone too far</Hint> </ItineraryItem> </RouteLeg> </Route> </Resources> </ResourceSet> </ResourceSets> </Response>

Listing 22 XML Response from Bing Maps REST Routing request