如何在 Windows Phone 8 中使用纬度和经度获取位置 [英] how to get location using Latitude and Longitude in windows phone 8
本文介绍了如何在 Windows Phone 8 中使用纬度和经度获取位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在c#中使用纬度和经度获取位置地址.请帮助
How can i get location address using Latitude and Longitude in c#.Please Help
推荐答案
试试这个代码,希望对你有帮助.
try this code ,I hope this will help you.
WebClient client = new WebClient();
string strLatitude = " 13.00";
string strLongitude = "80.25";
client.DownloadStringCompleted += client_DownloadStringCompleted;
string Url = "http://maps.googleapis.com/maps/api/geocode/json?latlng=" + strLatitude + "," + strLongitude + "&sensor=true";
client.DownloadStringAsync(new Uri(Url, UriKind.RelativeOrAbsolute));
Console.Read();
static void client_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
var getResult = e.Result;
JObject parseJson = JObject.Parse(getResult);
var getJsonres = parseJson["results"][0];
var getJson = getJsonres["address_components"][1];
var getAddress = getJson["long_name"];
string Address = getAddress.ToString();
}
这篇关于如何在 Windows Phone 8 中使用纬度和经度获取位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文