Csharp/C#教程:如何在Windows Phone 8.1 Universal App中获取街道地址的地理位置?分享


如何在Windows Phone 8.1 Universal App中获取街道地址的地理位置?

我的Windows Phone用户将在文本字段中输入街道地址。 我需要获取该地址字符串的地理位置,以便稍后我可以计算该地理位置的距离和电话的当前地址。

所以,我的问题是:
如何在Windows Phone 8.1 Universal App中获取街道地址的地理位置?

我在这个stackoverflow答案中找到了一个解决方案,但是,它适用于旧的Silverlight应用程序,而不是我目前正在使用的新的Universal Store应用程序API。

以下是获取地理位置以及启动路线默认地图的代码

这是MSDN链接

上述就是C#学习教程:如何在Windows Phone 8.1 Universal App中获取街道地址的地理位置?分享的全部内容,如果对大家有所用处且需要了解更多关于C#学习教程,希望大家多多关注—计算机技术网(www.ctvol.com)!

// Nearby location to use as a query hint. BasicGeoposition queryHint = new BasicGeoposition(); // DALLAS queryHint.Latitude = 32.7758; queryHint.Longitude = -96.7967; Geopoint hintPoint = new Geopoint(queryHint); MapLocationFinderResult result = await MapLocationFinder.FindLocationsAsync( "street, city, state zip", hintPoint, 3); if (result.Status == MapLocationFinderStatus.Success) { if (result.Locations != null && result.Locations.Count > 0) { Uri uri = new Uri("ms-drive-to:?destination.latitude=" + result.Locations[0].Point.Position.Latitude.ToString() + "&destination.longitude=" + result.Locations[0].Point.Position.Longitude.ToString() + "&destination.name=" + "myhome"); var success = await Windows.System.Launcher.LaunchUriAsync(uri); } } 

本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。

ctvol管理联系方式QQ:251552304

本文章地址:https://www.ctvol.com/cdevelopment/1031811.html

(0)
上一篇 2022年1月14日
下一篇 2022年1月14日

精彩推荐