Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

ReverseGeocodeRequestOptions Object

Bing

Contains options for a reverse geocode request.

Properties

Name Type Description

callback

function

The name of the function to call when a successful result is returned from the reverse geocode request. The callback function must accept two parameters: a result, which is a PlaceResult type, and a userData object.

errorCallback

function

The name of the function to call when the request is returned with an error. The callback function must accept a ReverseGeocodeRequestOptions object.

location

Location

The location to use to match to geographic entities and addresses.

timeout

number

A number indicating how long to wait, in seconds, for the reverse geocode request to return. The default value is 5 seconds.

userData

Object

An object containing any data that needs to be passed to the callback when the request is completed.

Example

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

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

      <script type="text/javascript">

      var map = null;

      function GetMap()
      {  

         map = new Microsoft.Maps.Map(document.getElementById("mapDiv"), {credentials: "Bing Maps Key", center: new Microsoft.Maps.Location(47.5, -122.3), zoom: 9 });

         Microsoft.Maps.loadModule('Microsoft.Maps.Search', { callback: searchModuleLoaded });

      }


      function searchModuleLoaded()
      {
         var searchManager = new Microsoft.Maps.Search.SearchManager(map);

         var reverseGeocodeRequest = {location:new Microsoft.Maps.Location(47.5, -121.5), count:10, callback:reverseGeocodeCallback, errorCallback:errCallback};
         searchManager.reverseGeocode(reverseGeocodeRequest);
      }
     
      function reverseGeocodeCallback(result, userData)
      {
         alert("The first result is " + result.name + ".");
      }


      function errCallback(request)
      {

         alert("An error occurred.");
      }
      
      </script>
   </head>
   <body onload="GetMap();">
      <div id='mapDiv' style="position:relative; width:600px; height:600px;"></div> 
   </body>
</html>

See Also

Show:
© 2015 Microsoft