我在我的应用程序中使用了bing地图,我使用gps定位当前位置,我也使用geoco-ordinatewatcher获取坐标,并使用图钉固定当前位置。但我的问题是,我想要获得图钉所指向的当前城市和国家的名称。我不能使用map.center属性来获得它。有谁能帮帮我吗?先谢谢你...
发布于 2012-05-30 18:40:10
下面的博客文章应该会对你有所帮助:
不幸的是,CivicAddressResolver目前还没有在Windows Phone上实现,所以你必须使用基于在线的解决方案。
发布于 2012-05-30 19:10:54
请参考下面的代码
ReverseGeocodeRequest reverseGeocodeRequest =新ReverseGeocodeRequest();//使用有效的必应地图密钥设置凭证reverseGeocodeRequest.Credentials =新GeoCodeService.Credentials();reverseGeocodeRequest.Credentials.ApplicationId =“您的必应地图密钥”;
// 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) {
string text1; 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);
}发布于 2012-05-30 18:42:13
无法从设备上的经纬度坐标解析位置。
要做到这一点,需要设备附带的所有地点的数据库来执行查找。这样的数据库将是巨大的,并且在保持其更新方面存在问题。
https://stackoverflow.com/questions/10813435
复制相似问题