Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

ImageryServiceClient.GetImageryMetadata Method

This documentation is no longer available on MSDN. It is available as a CHM or PDF download. For the newest Geocoding, Imagery, Routing and Traffic services, see the Bing Maps REST Services

Retrieves metadata for imagery hosted by Bing Maps.


public ImageryMetadataResponse GetImageryMetadata(ImageryMetadataRequest request)

Parameters

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 = "";
      try
      {
      // 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;

      }
      }
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.