【发布时间】:2014-12-15 01:55:10
【问题描述】:
有没有办法在 c# windows phone 8 应用程序的简单地图上显示我从当前位置获得的坐标?
这是我用来获取当前位置的代码。目前它只在文本块中显示坐标,但我需要将其转换为在地图上显示位置。
private async void GetCurrentLocation()
{
Geolocator locationFinder = new Geolocator();
try
{
Geoposition currentLocation = await locationFinder.GetGeopositionAsync(
maximumAge: TimeSpan.FromSeconds(120),
timeout: TimeSpan.FromSeconds(10));
String longitude = currentLocation.Coordinate.Longitude.ToString("0.00");
String latitude = currentLocation.Coordinate.Latitude.ToString("0.00");
MyTextBlock.Text = "Long: " + longitude + "Lat: " + latitude;
}
catch (UnauthorizedAccessException)
{
MessageBox.Show("And exception occured!");
}
}
感谢您的帮助!谢谢!
【问题讨论】:
-
换句话说,你想在地图上测试它吗?
-
@Kulasangar 完全正确。我的目标是在地图上显示该位置
-
我在下面发布了一个建议!
标签: c# windows-phone-8 geolocation maps latitude-longitude