Version

Displaying Geographic Imagery from Bing Maps

Purpose

This topic provides information on displaying geographic imagery from Bing Maps in the background content of the XamGeographicMap™ control.

Required background

The following table lists the topics required as a prerequisite to understanding this topic.

Topic Purpose

This topic provides information on how to add the XamGeographicMap control to an application page.

This topic provides information about the layout of the visual elements in the control

This topic provides an overview of rendering geographic imagery in the background content of the XamGeographicMap control.

In this topic

This topic contains the following sections:

Geographic Imagery from Bing Maps

Overview

Bing Maps is Microsoft’s® licensed geographic imagery mapping service. This geographic imagery service is accessible directly on the http://www.bing.com/maps web site. The XamGeographicMap control displays geographic imagery from Bing Maps in the map’s background content using the BingMapsMapImagery class. However, by default the XamGeographicMap control displays geographic imagery from the Open Street Maps in the map background content requiring you to configure the control to display Bing Maps’ geographic imagery. Prior to using Bing Maps’ geographic imagery, you must register and obtain a Bing Map API key from www.bingmapsportal.com. You must use the Bing Maps’ API key to set the BingMapsMapImagery object’s ApiKey property.

Before the 13.1 release, you had to configure a REST Service to access Bing Maps and retrieve the required titles URIs. With the release of 13.1 this functionality is now built-in to the XamGeographicMap control.

Previews

The following images are previews of the XamGeographicMap control in supported map styles of geographic imagery from the Bing Maps service.

GeographicMap Displaying Geographic Imagery from Bing Maps 2.png

Bing Map imagery with Road style

GeographicMap Displaying Geographic Imagery from Bing Maps 1.png

Bing Map imagery with Aerial and Labels style

GeographicMap Displaying Geographic Imagery from Bing Maps 3.png

Bing Map imagery with Aerial style

Requirements

In order to use geographic imagery from Bing Maps, you must first register and obtain a Map API key from the www.bingmapsportal.com website. You must set this Bing API key as the BingMapsMapImagery object’s ApiKey property.

Property settings

The following table summarizes important members of the BingMapsMapImagery class.

Property Name Property Type Description

String

Represents the property for setting an API key required for the Bing Maps imagery service.

You must obtain this key from the http://www.bingmapsportal.com website.

String

Represents the property for setting the Bing Imagery REST URI specifying where the TilePath and SubDomains will come from. This is an optional property, and if not specified it will use the default REST URI.

String

Represents a property for setting the culture name for the tile source.

Represents the property for setting the Bing Maps imagery tiles map style. This property can be set to the following BingMapsImageryStyle enumeration values:

  • Aerial - Specifies the Aerial map style without road or labels overlay

  • AerialWithLabels - Specifies the Aerial map style with road and labels overlay

  • Road - Specifies the Roads map style without Aerial overlay

Boolean

Represents the property that specifies whether or not the Bing Maps service should auto-initialized upon the assignment of valid property values.

Boolean

Represents the property that is set to True occurs when geographic imagery tiles from Bing Maps service have been initialized and they are ready for rendering in the XamGeographicMap control.

ObservableCollection<string>

Represents an image collection of URI subdomains

String

Represents a property that sets the map tile image URI, this is the actual location of the Bing Maps

Example

The screenshot following this table illustrates how to display geographic imagery from Bing Maps in the background content of the XamGeographicMap control. This is accomplished by configuring the XamGeographicMap control as follows:

Property * Value*

BingMapsMapImagery

Road

Bing Map API key

GeographicMap Displaying Geographic Imagery from Bing Maps 2.png

Following is the code used in implementing this example:

Note
Note

You must replace those strings set to the ApiKey property with your own Bing Map API key.

In XAML:

<ig:XamGeographicMap Name="igMap">
   <ig:XamGeographicMap.BackgroundContent>
      <ig:BingMapsMapImagery ImageryStyle="Road"
                    ApiKey="API_KEY" />
   </ig:XamGeographicMap.BackgroundContent>
</ig:XamGeographicMap>

In Visual Basic:

Dim igMap As XamGeographicMap
Dim bingMaps as BingMapsMapImagery
bingMaps.ImageryStyle = BingMapsImageryStyle.Aerial
bingMaps.ApiKey = "API_KEY"
igMap.BackgroundContent = bingMaps

In C#:

var igMap = new XamGeographicMap
var bingMaps = new BingMapsMapImagery();
bingMaps.ImageryStyle = BingMapsImageryStyle.Aerial;
bingMaps.ApiKey = "API_KEY";
igMap.BackgroundContent = bingMaps;

Related Content

The following topics provide additional information related to this topic.

Topic Purpose

This topic provides information on how to bind geographic imagery in the XamGeographicMap control.

This topic provides information on how to display geographic imagery from Open Street Maps service in the XamGeographicMap control.