首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在bing地图中利用gps获取当前城市名称

问如何在bing地图中利用gps获取当前城市名称
EN

Stack Overflow用户
提问于 2012-05-30 17:23:25
回答 3查看 2.5K关注 0票数 2

我在我的应用程序中使用了bing地图,我使用gps定位当前位置,我也使用geoco-ordinatewatcher获取坐标,并使用图钉固定当前位置。但我的问题是,我想要获得图钉所指向的当前城市和国家的名称。我不能使用map.center属性来获得它。有谁能帮帮我吗?先谢谢你...

EN

回答 3

Stack Overflow用户

发布于 2012-05-30 18:40:10

下面的博客文章应该会对你有所帮助:

http://www.nickharris.net/2010/12/how-to-reverse-geocode-a-location-to-an-address-on-windows-phone-7/

不幸的是,CivicAddressResolver目前还没有在Windows Phone上实现,所以你必须使用基于在线的解决方案。

票数 1
EN

Stack Overflow用户

发布于 2012-05-30 19:10:54

请参考下面的代码

ReverseGeocodeRequest reverseGeocodeRequest =新ReverseGeocodeRequest();//使用有效的必应地图密钥设置凭证reverseGeocodeRequest.Credentials =新GeoCodeService.Credentials();reverseGeocodeRequest.Credentials.ApplicationId =“您的必应地图密钥”;

代码语言:javascript
复制
        // Set the point to use to find a matching address
        GeoCodeService.Location point = new GeoCodeService.Location();
        point.Latitude = Your lat;
        point.Longitude = Your lng;

        reverseGeocodeRequest.Location = point;

        // Make the reverse geocode request
        GeocodeServiceClient geocodeService = new GeocodeServiceClient("BasicHttpBinding_IGeocodeService");
        geocodeService.ReverseGeocodeCompleted += new EventHandler<ReverseGeocodeCompletedEventArgs>(geocodeService_ReverseGeocodeCompleted);
        geocodeService.ReverseGeocodeAsync(reverseGeocodeRequest);

void geocodeService_ReverseGeocodeCompleted(对象发送者,ReverseGeocodeCompletedEventArgse) {

代码语言:javascript
复制
             string text1;
代码语言:javascript
复制
            GeocodeResponse geocodeResponse = e.Result;
            System.Diagnostics.Debug.WriteLine("GeoCode Response is :"+geocodeResponse);
            if (geocodeResponse.Results.Count() > 0)
               text1  = geocodeResponse.Results[0].DisplayName;
            else
                text1 = "No Results found";
            textBlock1.Text = text1;
            System.Diagnostics.Debug.WriteLine("Location is :"+text1);
    }
票数 1
EN

Stack Overflow用户

发布于 2012-05-30 18:42:13

无法从设备上的经纬度坐标解析位置。

要做到这一点,需要设备附带的所有地点的数据库来执行查找。这样的数据库将是巨大的,并且在保持其更新方面存在问题。

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

https://stackoverflow.com/questions/10813435

复制
相关文章

相似问题

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