ImageryServiceClient.GetImageryMetadata Method


Retrieves metadata for imagery hosted by Bing Maps.

public ImageryMetadataResponse GetImageryMetadata(ImageryMetadataRequest request)


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

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;