ImageryServiceClient.GetImageryMetadata Method


Retrieves metadata for imagery hosted by Bing Maps.


public ImageryMetadataResponse GetImageryMetadata(ImageryMetadataRequest request)
Public Function GetImageryMetadata(ByVal request As ImageryMetadataRequest) As ImageryMetadataResponse



An ImageryMetadataRequest object that contains the header and parameter information for the service operation.

Return Value

Returns an ImageryMetadataResponse Class, which contains an ImageryMetadataResult Class array.


The ImageryProviders property contains the imagery data providers for the map style specified in the VEImageryMetadataOptions.MapStyle Property. If imagery metadata is needed for two different map styles, two GetImageryMetadata requests need to be made.


private void RequestImageryMetadata()
string Results = "";
// Set a Bing Maps key before making a request
string key = "Bing Maps Key";

ImageryService.ImageryMetadataRequest metadataRequest = new ImageryService.ImageryMetadataRequest();

// Set credentials using a valid Bing Maps Key
metadataRequest.Credentials = new ImageryService.Credentials();
metadataRequest.Credentials.ApplicationId = key;

// Set the imagery metadata request options
ImageryService.Location centerLocation = new ImageryService.Location();
centerLocation.Latitude = 47.65;
centerLocation.Longitude = -122.24;

metadataRequest.Options = new ImageryService.ImageryMetadataOptions();
metadataRequest.Options.Location = centerLocation;
metadataRequest.Options.ZoomLevel = 10;

metadataRequest.Style = ImageryService.MapStyle.AerialWithLabels_v1;

// Make the imagery metadata request
ImageryService.ImageryServiceClient imageryService
= new ImageryService.ImageryServiceClient("BasicHttpBinding_IImageryService");
ImageryService.ImageryMetadataResponse metadataResponse = imageryService.GetImageryMetadata(metadataRequest);

Results = "The image requested was created between " + metadataResponse.Results[0].Vintage.From.ToString() + " and " + metadataResponse.Results[0].Vintage.To.ToString();

catch (Exception ex)
Results = "An exception occurred: " + ex.Message;

Private Sub RequestImageryMetadata()
Dim Results As String
' Set a Bing Maps key before making a request
Dim key = "Bing Maps Key"

Dim metadataRequest As New ImageryService.ImageryMetadataRequest()

' Set credentials using a valid Bing Maps Key
metadataRequest.Credentials = _
New ImageryService.Credentials() With {.ApplicationId = key}

' Set the imagery metadata request options
Dim centerLocation As New ImageryService.Location() _
With {.Latitude = 47.65, .Longitude = -122.24}

metadataRequest.Options = New ImageryService.ImageryMetadataOptions() _
With {.Location = centerLocation, .ZoomLevel = 10}

metadataRequest.Style = ImageryService.MapStyle.AerialWithLabels_v1

' Make the imagery metadata request
Dim ImageryServiceInstance As New ImageryService.ImageryServiceClient("BasicHttpBinding_IImageryService")
Dim metadataResponse = ImageryServiceInstance.GetImageryMetadata(metadataRequest)

Results = "The image requested was created between " & _
metadataResponse.Results(0).Vintage.From & " and " & _

Catch ex As Exception
Results = "An exception occurred: " & ex.Message
End Try
End Sub

See Also

ImageryServiceClient.GetMapUri Method
Understanding Tiles