Export (0) Print
Expand All

GeocodeServiceClient.ReverseGeocode 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

Finds geographic entities and addresses for a specified map location (known as reverse geocoding).

public GeocodeResponse ReverseGeocode(ReverseGeocodeRequest request)

request

A ReverseGeocodeRequest object that contains the header and parameter information for the service operation.



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

GeocodeService.ReverseGeocodeRequest reverseGeocodeRequest = new GeocodeService.ReverseGeocodeRequest();

// Set the credentials using a valid Bing Maps key
reverseGeocodeRequest.Credentials = new GeocodeService.Credentials();
reverseGeocodeRequest.Credentials.ApplicationId = key;

// Set the point to use to find a matching address
GeocodeService.Location point = new GeocodeService.Location();
point.Latitude = 47.608;
point.Longitude = -122.337;

reverseGeocodeRequest.Location = point;

// Make the reverse geocode request
GeocodeService.GeocodeServiceClient geocodeService =
new GeocodeService.GeocodeServiceClient("BasicHttpBinding_IGeocodeService");
GeocodeService.GeocodeResponse geocodeResponse = geocodeService.ReverseGeocode(reverseGeocodeRequest);

Results = geocodeResponse.Results[0].DisplayName;

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

}

}



    
Show:
© 2014 Microsoft