![](/img/trans.png)
[英]The type or namespace name 'Exchange' does not exist in the namespace
[英]The type or namespace name 'Confidence' does not exist in the namespace
我正在使用Bing Maps
, SOAP
, c#
和.net
。 我想实现GeocodeAddress()
,但名称空间中不存在类型或名称空间名称'Confidence'
:
private String GeocodeAddress(string address)
{
string results = "";
string key = "insert your Bing Maps key here";
GeocodeRequest geocodeRequest = new GeocodeRequest();
// Set the credentials using a valid Bing Maps key
geocodeRequest.Credentials = new DevExpress.Map.BingServices.Credentials();
geocodeRequest.Credentials.ApplicationId = key;
// Set the full address query
geocodeRequest.Query = address;
// Set the options to only return high confidence results
ConfidenceFilter[] filters = new ConfidenceFilter[1];
filters[0] = new ConfidenceFilter();
filters[0].MinimumConfidence = GeocodeService.Confidence.High;
// Add the filters to the options
GeocodeOptions geocodeOptions = new GeocodeOptions();
geocodeOptions.Filters = filters;
geocodeRequest.Options = geocodeOptions;
// Make the geocode request
GeocodeServiceClient geocodeService = new GeocodeServiceClient();
GeocodeResponse geocodeResponse = geocodeService.Geocode(geocodeRequest);
if (geocodeResponse.Results.Length > 0)
results = String.Format("Latitude: {0}\nLongitude: {1}",
geocodeResponse.Results[0].Locations[0].Latitude,
geocodeResponse.Results[0].Locations[0].Longitude);
else
results = "No Results Found";
return results;
}
看来您正在使用Bing Maps的老式SOAP服务。 Bing Maps团队停止推荐使用6年前的产品。 Bing Maps REST服务更快,具有更多功能并定期更新。 可以在以下位置找到有关REST服务的文档: https : //msdn.microsoft.com/en-us/library/ff701713.aspx
这里有有关如何在.NET中使用REST服务的文档: https : //msdn.microsoft.com/zh-cn/library/jj819168.aspx
我还建议您在此处查看最佳做法文档: https : //msdn.microsoft.com/zh-cn/library/dn894107.aspx
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.