Is there any way to display coordinates that i get from my current location on a simple map in c# windows phone 8 application?
This is the code that i use to get my current location. For now it only displays coordinates in textblock, but i need to convert it to display position on map.
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!");
}
}
Any help is appreciated!Thanks!
If so you could use a PushPin
to show the current location on a map
.
Reference : Windows Phone : Location : Map : Pushpin
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.