可能重复: 如何用wp7获取GPS坐标的地址名
我正在开发一个WP8 application.In,我的应用程序,我想从它的地理坐标中获取一个特定位置的细节,比如位置名。我可以得到设备当前的gps位置。但它只给出了地理坐标。有没有提供地理坐标定位细节的服务。请帮帮我。
发布于 2012-12-05 10:45:47
是的,您可以使用bing API获得特定的位置细节。http://msdn.microsoft.com/en-us/library/ff701722.aspx http://stackoverflow.com/questions/9109996/getting-location-name-from-longitude-and-latitude-in-bingmap
希望这能帮上忙。
开尔文
发布于 2012-12-06 02:36:44
你要找的是反向地理编码。将地理坐标转换为地址。
正如前面提到的,您可以在WP7上使用谷歌和必应来实现这一点。在windows 8上,地理编码和反向地理编码作为框架的一部分得到支持。您可以阅读GeoCoding 在这篇诺基亚入门文章中的概述(在“Geocoding”下)和更全面的概述在诺基亚的另一篇文章里。
下面是一个将坐标转换为地址的反向Geocoding示例:
private void Maps_ReverseGeoCoding(object sender, RoutedEventArgs e)
{
ReverseGeocodeQuery query = new ReverseGeocodeQuery()
{
GeoCoordinate = new GeoCoordinate(37.7951799798757, -122.393819969147)
};
query.QueryCompleted += query_QueryCompleted;
query.QueryAsync();
}
void query_QueryCompleted(object sender, QueryCompletedEventArgs<IList<MapLocation>> e)
{
StringBuilder sb = new StringBuilder();
sb.AppendLine("Ferry Building Geocoding results...");
foreach (var item in e.Result)
{
sb.AppendLine(item.GeoCoordinate.ToString());
sb.AppendLine(item.Information.Name);
sb.AppendLine(item.Information.Description);
sb.AppendLine(item.Information.Address.BuildingFloor);
sb.AppendLine(item.Information.Address.BuildingName);
sb.AppendLine(item.Information.Address.BuildingRoom);
sb.AppendLine(item.Information.Address.BuildingZone);
sb.AppendLine(item.Information.Address.City);
sb.AppendLine(item.Information.Address.Continent);
sb.AppendLine(item.Information.Address.Country);
sb.AppendLine(item.Information.Address.CountryCode);
sb.AppendLine(item.Information.Address.County);
sb.AppendLine(item.Information.Address.District);
sb.AppendLine(item.Information.Address.HouseNumber);
sb.AppendLine(item.Information.Address.Neighborhood);
sb.AppendLine(item.Information.Address.PostalCode);
sb.AppendLine(item.Information.Address.Province);
sb.AppendLine(item.Information.Address.State);
sb.AppendLine(item.Information.Address.StateCode);
sb.AppendLine(item.Information.Address.Street);
sb.AppendLine(item.Information.Address.Township);
}
MessageBox.Show(sb.ToString());
}当我在我的WP8上运行这个代码片段时,我会得到以下消息框:

https://stackoverflow.com/questions/13720890
复制相似问题