How to Get the Address based on the Co-Ordinates in Windows Phone 8 ?

Published on November 26, 2013 by abundantcode

Filed under Windows Phone

Last modified November 26, 2013

Print this page

rate 1 star rate 2 star rate 3 star rate 4 star rate 5 star
Your rating: none, Average: 0 (0 votes)

This article have been viewed 4502 times

Below is a sample code snippet that demonstrates how to get the address of the location based on the co-ordinates in Windows Phone 8.

How to Get the Address based on the Co-Ordinates in Windows Phone 8 ?

In the below code snippet , the latitude and longitude is fixed . The Google’s API is used to get the location details by passing it to the WebClient . The WebClient in turn returns the JSON file which contains the location details.

string latitude = "12.898477";
string longitude = "77.6391137";
WebClient client = new WebClient();
client.DownloadStringCompleted += client_DownloadStringCompleted;
string Url = "http://maps.googleapis.com/maps/api/geocode/json?latlng=" + latitude+ "," + longitude +"&sensor=true";
client.DownloadStringAsync(new Uri(Url, UriKind.RelativeOrAbsolute));
// Result
void client_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
   var data = e.Result.ToList();
}
If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.

1 Comment

  1. ahmed

    there is an error in this line:
    var data = e.Result.ToList();

    “string does not have definition for ToList”

    March 24, 2014 - 8:20 pm – Reply

Leave a Comment


x

You might be Interested in these Posts

How to delete user account from command line in Windows 10 ?

You can delete a user account from command line in Windows 10 using the net user command and specify...

How to add new user account from command line in Windows 10 ?

You can add a new user account in Windows 10 using command prompt using the net user command and pas...

How to open display settings from command line in Windows 10 ?

The display properties can be found in the settings app in Windows 10 which lets the users to config...