Infragistics(R) NetAdvantage(R) : WPF 2012.1
Display Different Layer Types
E-mail your feedback on this topic.
Shared XAML > Maps > xamMap > Using xamMap > Geo-Imagery Integration > Display Different Layer Types

Glossary Item Box

This section gives you instructions on how to display different layer types of supported geo-imagery in the xamMap™ control.

Cloud Made Maps

The CloudMadeTileSource provides only road view with customizable Cloud Made Map styles. For complete list of Cloud Made Map styles, please refer to this website and/or to Display Different CloudMade Map Styles section.

Open Street Maps

The OpenStreetMapTileSource provides only road view of the geo-imagery from Open Street Maps source.

Bing Maps

The BingMapsTileSource provides three map views: Aerial, Aerial with Labels, and Road. The following code sample assumes that you know how to display BingMaps geo-imagery using a web service and token variable was created by providing valid network credentials to access the web service.

Change the ImageryMetadataRequest object’s MapStyle property to MapStyle.Aerial

In Visual Basic:

Public Sub New()
    InitializeComponent()
    Dim mapUriRequest As New BingImageryServiceReference.ImageryMetadataRequest()
    mapUriRequest.Credentials = New BingImageryServiceReference.Credentials()
    mapUriRequest.Credentials.ApplicationId = "BING_MAPS_SECRET_KEY"
    ' set layer type for geo-imagery source
    mapUriRequest.Style = BingImageryServiceReference.MapStyle.Aerial
    ' create asynchronous Bing Maps service to handle geo-imagery requests
    
    Dim imageryService As New BingImageryServiceReference.ImageryService()
    AddHandler imageryService.GetImageryMetadataCompleted, AddressOf imageryService_GetImageryMetadataCompleted
    imageryService.GetImageryMetadataAsync(mapUriRequest)
End Sub
Private Sub imageryService_GetImageryMetadataCompleted(ByVal sender As Object, ByVal e As BingImageryServiceReference.GetImageryMetadataCompletedEventArgs)
    Dim result As BingImageryServiceReference.ImageryMetadataResult = e.Result.Results(0)
    Dim source As New Infragistics.Controls.Maps.BingMapsTileSource()
    source.TilePath = result.ImageUri
    source.SubDomains = New ObservableCollection(Of String)(result.ImageUriSubdomains)
    xamMap.MapTileSource = source
End Sub

In C#:

public MainPage() { InitializeComponent(); BingImageryServiceReference.ImageryMetadataRequest mapUriRequest = new BingImageryServiceReference.ImageryMetadataRequest(); mapUriRequest.Credentials = new BingImageryServiceReference.Credentials(); mapUriRequest.Credentials.ApplicationId = "BING_MAPS_SECRET_KEY";

// set layer type for geo-imagery source mapUriRequest.Style = BingImageryServiceReference.MapStyle.Aerial; // create asynchronous Bing Maps service to handle geo-imagery requests BingImageryServiceReference.ImageryService imageryService = new BingImageryServiceReference.ImageryService(); imageryService.GetImageryMetadataCompleted += imageryService_GetImageryMetadataCompleted; imageryService.GetImageryMetadataAsync(mapUriRequest); } void imageryService_GetImageryMetadataCompleted(object sender, BingImageryServiceReference.GetImageryMetadataCompletedEventArgs e) { BingImageryServiceReference.ImageryMetadataResult result = e.Result.Results[0]; xamMap.MapTileSource = newInfragistics.Controls.Maps.BingMapsTileSource() { TilePath = result.ImageUri, SubDomains = new ObservableCollection<string>(result.ImageUriSubdomains) }; }

Change the ImageryMetadataRequest object’s MapStyle property to MapStyle.AerialWithLabels

In Visual Basic:

Public Sub New()
    InitializeComponent()
    Dim mapUriRequest As New BingImageryServiceReference.ImageryMetadataRequest()
    mapUriRequest.Credentials = New BingImageryServiceReference.Credentials()
    mapUriRequest.Credentials.ApplicationId = "BING_MAPS_SECRET_KEY"
    ' set layer type for geo-imagery source
    mapUriRequest.Style = BingImageryServiceReference.MapStyle.AerialWithLabels
    ' create asynchronous Bing Maps service to handle geo-imagery requests
    
    Dim imageryService As New BingImageryServiceReference.ImageryService()
    AddHandler imageryService.GetImageryMetadataCompleted, AddressOf imageryService_GetImageryMetadataCompleted
    imageryService.GetImageryMetadataAsync(mapUriRequest)
End Sub
Private Sub imageryService_GetImageryMetadataCompleted(ByVal sender As Object, ByVal e As BingImageryServiceReference.GetImageryMetadataCompletedEventArgs)
    Dim result As BingImageryServiceReference.ImageryMetadataResult = e.Result.Results(0)
    Dim source As New Infragistics.Controls.Maps.BingMapsTileSource()
    source.TilePath = result.ImageUri
    source.SubDomains = New ObservableCollection(Of String)(result.ImageUriSubdomains)
    xamMap.MapTileSource = source
End Sub

In C#:

public MainPage()
{
    InitializeComponent();
    BingImageryServiceReference.ImageryMetadataRequest mapUriRequest = new BingImageryServiceReference.ImageryMetadataRequest();
    mapUriRequest.Credentials = new BingImageryServiceReference.Credentials();
    mapUriRequest.Credentials.ApplicationId = "BING_MAPS_SECRET_KEY";

// set layer type for geo-imagery source mapUriRequest.Style = BingImageryServiceReference.MapStyle.AerialWithLabels; // create asynchronous Bing Maps service to handle geo-imagery requests BingImageryServiceReference.ImageryService imageryService = new BingImageryServiceReference.ImageryService(); imageryService.GetImageryMetadataCompleted += imageryService_GetImageryMetadataCompleted; imageryService.GetImageryMetadataAsync(mapUriRequest); } void imageryService_GetImageryMetadataCompleted(object sender, BingImageryServiceReference.GetImageryMetadataCompletedEventArgs e) { BingImageryServiceReference.ImageryMetadataResult result = e.Result.Results[0]; xamMap.MapTileSource = newInfragistics.Controls.Maps.BingMapsTileSource() { TilePath = result.ImageUri, SubDomains = new ObservableCollection<string>(result.ImageUriSubdomains) }; }