Share via


VEMap.GetImageryMetadata Method

You are not viewing the latest version of the AJAX control. Bing Maps AJAX V7 is the recommended JavaScript control for Bing Maps. If you need this documentation, it is available in as a CHM or PDF download.

Returns information about the requested imagery, including imagery date stamps. This method requires that a valid Bing Maps Key has been set using the VEMap.SetCredentials Method.

VEMap.GetImageryMetadata(callback, options);

Parameters

Parameter Description

callback

The name of the function to call when results are returned. The function must accept a VEImageryMetadata Class object. Required.

options

A VEImageryMetadataOptions Class object specifying the imagery for which information is returned. Optional.

Return Value

Returns a VEImageryMetadata Class to the callback function.

Remarks

If the options parameter is not specified, then the GetImageryMetadata method returns information about the current map view.

The GetImageryMetadata method is supported for VEMapStyle.Aerial and VEMapStyle.Hybrid.

In order to retrieve imagery metadata, use the VEMap.SetCredentials Method to set a valid token before calling the GetImageryMetadata method.

Example

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
   <head>
      <title>GetImageryMetadata</title>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

      <script type="text/javascript" src="https://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.3"></script>

      <script type="text/javascript">
         var map     = null;         

         function GetMap()
         {  

            map = new VEMap('myMap');

            //A token is required to retrieve imagery metadata
            map.SetClientToken("MyValidVEToken");

            map.LoadMap();

            map.SetMapStyle(VEMapStyle.Aerial);

         }

         
         // Get imagery meta data of the current map
         function GetMetadata()
         {

            map.GetImageryMetadata(MetadataCallback, null);
         }

         function MetadataCallback(metaData)
         {
            alert("Imagery date range: " + metaData.DateRangeStart + " - " + metaData.DateRangeEnd);
         }

      </script>
   </head>
   <body onload="GetMap();">
      <div id='myMap' style="position:relative; width:600px; height:400px;"></div>
      <input type="button" onclick="GetMetadata();" value="Get Imagery Metadata"/>
   </body>
</html>

See Also

Concepts

VEImageryMetadata Class
VEImageryMetadataOptions Class