Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/68.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Windows phone 7 如何在bing地图中使用gps获取当前城市名称_Windows Phone 7_Bing Maps_Pushpin - Fatal编程技术网

Windows phone 7 如何在bing地图中使用gps获取当前城市名称

Windows phone 7 如何在bing地图中使用gps获取当前城市名称,windows-phone-7,bing-maps,pushpin,Windows Phone 7,Bing Maps,Pushpin,我在我的应用程序中使用了bing地图,我使用gps定位当前位置,我也使用GeoCoordinationWatcher获取坐标,并用图钉固定当前位置。但我的问题是,我想得到图钉指向的当前城市和国家的名称。我无法使用map.center属性获取该属性。有人能帮我吗。。提前感谢…以下博文将对您有所帮助:- 不幸的是,CivicAddressResolver目前未在Windows Phone上实现,因此您必须使用基于在线的解决方案。无法从设备上的横向/纵向坐标解析位置。 要做到这一点,需要设备附带一个

我在我的应用程序中使用了bing地图,我使用gps定位当前位置,我也使用GeoCoordinationWatcher获取坐标,并用图钉固定当前位置。但我的问题是,我想得到图钉指向的当前城市和国家的名称。我无法使用map.center属性获取该属性。有人能帮我吗。。提前感谢…

以下博文将对您有所帮助:-


不幸的是,CivicAddressResolver目前未在Windows Phone上实现,因此您必须使用基于在线的解决方案。

无法从设备上的横向/纵向坐标解析位置。

要做到这一点,需要设备附带一个包含所有位置的数据库来进行查找。这样一个数据库将是巨大的,并且在保持更新时会出现问题。

请参考下面的代码

ReverseGeocodeRequest ReverseGeocodeRequest=新的ReverseGeocodeRequest(); //使用有效的Bing映射密钥设置凭据 reverseGeocodeRequest.Credentials=新的GeoCodeService.Credentials(); reverseGeocodeRequest.Credentials.ApplicationId=“您的bing地图密钥”


您可以使用Bing地图位置API,如下所述:。这就是你想要的吗?不,我不喜欢使用API。在wp7内部是否有默认的方法/服务来实现这一点?据我所知,无法获取位置描述(如城市、国家等)不使用某种基于web的服务。反向地理代码请求/响应使用哪个命名空间/dll?请参阅此链接,您可以包括地理代码服务:并且必须将集合类型更改为System.Array(在配置服务参考中)
        // 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);
            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);
    }