我正在使用以下服务参考从纬度和经度获取位置详细信息
http://dev.virtualearth.net/webservices/v1/geocodeservice/geocodeservice.svc
我将上述 URL 添加到我的服务参考类中,并尝试通过调用以下方法获取位置详细信息
public void reverse()
{
string Results = "";
try
{
// Set a Bing Maps key before making a request
string key = "Bing Maps Key";
ReverseGeocodeRequest reverseGeocodeRequest = new 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
GeocodeServiceClient geocodeService = new GeocodeServiceClient();
**GeocodeResponse geocodeResponse = geocodeService.ReverseGeocode(reverseGeocodeRequest);**
}
catch (Exception ex)
{
Results = "An exception occurred: " + ex.Message;
}
但我收到以下错误消息
GeoCodeService.GeoCodeServiceClient 不包含 ReverseGeocode 的定义和扩展方法
找不到 GeoCodeService.GeoCodeServiceClient。
帮助我解决问题。还告诉我这是查找位置详细信息的最佳方法。