Reputation: 1439
I am able to get the latitude and longitude using Geoposition class.How can I find the name of the current location in windows phone 8?
Upvotes: 1
Views: 666
Reputation: 6424
You have a built-in API for reverse geocoding in Windows Phone 8. You can do it as follows, for example, to ghet the name of the city:
string address;
ReverseGeocodeQuery query = new ReverseGeocodeQuery();
query.GeoCoordinate = yourGeoCoordinateObject;
query.QueryCompleted += (s, e) =>
{
if (e.Error != null)
return;
address = e.Result[0].Information.Address.City;
};
query.QueryAsync();
Upvotes: 3
Reputation:
This is known as Reverse Geocoding. Google offer this as part of their Geocoding API. The specific reference is here
You can make a call to their API with a simple HTTP request:
http://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73.961452&sensor=true
And they'll return a list of human-readable names in JSON format.
Upvotes: 1