首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >命名空间中不存在类型或命名空间名称“”Confidence“”

命名空间中不存在类型或命名空间名称“”Confidence“”
EN

Stack Overflow用户
提问于 2016-06-01 14:39:17
回答 1查看 102关注 0票数 0

我使用的是Bing MapsSOAPc#.net。我想实现GeocodeAddress(),但类型或命名空间名称'Confidence'在命名空间中不存在:

代码语言:javascript
复制
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;
        }
EN

回答 1

Stack Overflow用户

发布于 2016-06-01 16:23:05

看起来您正在为Bing Maps使用非常旧的SOAP服务。必应地图团队早在6年前就不再推荐使用这些地图了。Bing地图的REST服务速度更快,功能更多,并且会定期更新。有关REST服务的文档可在此处找到:https://msdn.microsoft.com/en-us/library/ff701713.aspx

这里有关于如何在.NET中使用REST服务的文档:https://msdn.microsoft.com/en-us/library/jj819168.aspx

我还建议在这里查看最佳实践文档:https://msdn.microsoft.com/en-us/library/dn894107.aspx

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/37561195

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档