如何在Windows Phone 8中使用纬度和经度获取位置

时间:2014-03-29 15:04:03

标签: c# windows-phone-8

如何在c#.Please Help

中使用纬度和经度获取位置地址

2 个答案:

答案 0 :(得分:7)

试试这段代码,我希望这会对你有帮助。

 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();

}

答案 1 :(得分:1)