Getting started with Bing Maps in the ArcGIS JavaScript APIE-mail This Topic Printable Version Give Us Feedback

Beginning at version 1.4 of the ArcGIS JavaScript API, you can use Bing Maps (formerly Microsoft Virtual Earth) maps and geocoding in your Web applications. To get started, you need to do the following:

  1. Obtain your Bing Maps user name and password from your ArcGIS Server administrator.
  2. Download and configure the "Get Virtual Earth Token" page that matches your development platform.
  3. Write client-side code that requests a token and uses it to access Bing Maps.

1. Obtain your Bing Maps user name and password from your ArcGIS Server administrator

To work with Bing Maps, you need a Bing Maps account. Access to the free (staging) and for-fee (production) Bing Maps services is bundled with purchases of ArcGIS Server. Talk with your ArcGIS Server administrator to learn the user name and password assigned to you for using Bing Maps. If your administrator does not know about the name and password, contact ESRI Customer Service to learn which Bing Maps services you can access and to obtain your name and password.

2. Download and configure the "Get Virtual Earth Token" page that matches your development platform

Bing Maps services require authentication using tokens. Instead of sending a name and password to Bing Maps every time you want to see a map or geocode a place, you use the name and password to get a token. The token is a string of characters that Bing Maps recognizes as valid for obtaining a service for a limited period of time. Whenever your application needs to geocode an address or display a map, it can pass the token to Bing Maps.

To get tokens for Bing Maps, you need to configure a "Get Virtual Earth Token" page on your Web server. Choose the link below that corresponds to your development platform. You'll be taken to a download page with instructions on how to configure the "Get Virtual Earth Token" page:

3. Write client-side code that requests a token and uses it to access Bing Maps

The ArcGIS JavaScript API includes classes you can use to work with Bing Maps services. The online SDK contains the following samples that use Bing Maps.

The following information about how tokens are requested and used may help you better understand the code required to work with Bing Maps services.

When your application needs to connect to Bing Maps, it uses the "Get Virtual Earth Token" page to securely send your user name and password to an ESRI-hosted REST adapter service that can communicate with Bing Maps through SOAP.

The REST adapter requests two tokens. The client token can be used by your browser to request map tiles directly from Bing Maps. The server token is used for functions that have to go through the REST adapter, namely geocoding operations and initial back-end calls for metadata that occur when you connect to Bing Maps services.

Each token has a duration, which is the amount of time in minutes for which the token will be valid before the application requests another one. Each token is also valid for one type of server environment (staging or production). The Bing Maps staging server is free and is for development purposes only. Map tiles from the staging server contain a watermark. The production server charges against your account, but its tiles contain no watermark.

The "Get Virtual Earth Token" page contains defaults for the duration and environment. You can override these default values in the VETiledLayer and VEGeocoder constructors.

More information about Bing Maps

The Bing Maps road and aerial maps can provide detailed context for your proprietary data. The maps are served directly by Microsoft as tiled images, which means they perform quickly, you don't have to maintain them, and they're available in a growing number of languages. Similarly, the Bing Maps geocoding accesses a constantly growing worldwide catalog of places, maintained by Microsoft and exposed through a Web service.