首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Windows 8中GeoCoordinates的位置详细信息

Windows 8中GeoCoordinates的位置详细信息
EN

Stack Overflow用户
提问于 2012-12-05 10:18:45
回答 2查看 4.8K关注 0票数 1

可能重复: 如何用wp7获取GPS坐标的地址名

我正在开发一个WP8 application.In,我的应用程序,我想从它的地理坐标中获取一个特定位置的细节,比如位置名。我可以得到设备当前的gps位置。但它只给出了地理坐标。有没有提供地理坐标定位细节的服务。请帮帮我。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 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

希望这能帮上忙。

开尔文

票数 2
EN

Stack Overflow用户

发布于 2012-12-06 02:36:44

你要找的是反向地理编码。将地理坐标转换为地址。

正如前面提到的,您可以在WP7上使用谷歌和必应来实现这一点。在windows 8上,地理编码和反向地理编码作为框架的一部分得到支持。您可以阅读GeoCoding 在这篇诺基亚入门文章中的概述(在“Geocoding”下)和更全面的概述在诺基亚的另一篇文章里

下面是一个将坐标转换为地址的反向Geocoding示例:

代码语言:javascript
复制
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上运行这个代码片段时,我会得到以下消息框:

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

https://stackoverflow.com/questions/13720890

复制
相关文章

相似问题

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