I have used bing map in my app,where i locate the current location using gps and i'm getting the co-ordinates using geoco-ordinatewatcher as well and pin the current location with pushpin. but my issue is that i wanna get the current city and country name where the pushpin is pointing. i couldn't get that using map.center property. can anyone help me out.. Thanks in advance...
How to Get the the Current city name using gps in bing map
2.6k Views Asked by Csharp_crack At
3
There are 3 best solutions below
0

There is no way to resolve a location from lat/long coordinates on the device.
To do so would require that a database of all places ship with the device to do the lookup. Such a database would be huge and present issues with keeping it updated.
2

please, refer the below code
ReverseGeocodeRequest reverseGeocodeRequest = new ReverseGeocodeRequest(); // Set the credentials using a valid Bing Maps key reverseGeocodeRequest.Credentials = new GeoCodeService.Credentials(); reverseGeocodeRequest.Credentials.ApplicationId = "Your bing map key";
// Set the point to use to find a matching address
GeoCodeService.Location point = new GeoCodeService.Location();
point.Latitude = Your lat;
point.Longitude = Your lng;
reverseGeocodeRequest.Location = point;
// Make the reverse geocode request
GeocodeServiceClient geocodeService = new GeocodeServiceClient("BasicHttpBinding_IGeocodeService");
geocodeService.ReverseGeocodeCompleted += new EventHandler<ReverseGeocodeCompletedEventArgs>(geocodeService_ReverseGeocodeCompleted);
geocodeService.ReverseGeocodeAsync(reverseGeocodeRequest);
void geocodeService_ReverseGeocodeCompleted(object sender, ReverseGeocodeCompletedEventArgse)
{
string text1;
GeocodeResponse geocodeResponse = e.Result;
System.Diagnostics.Debug.WriteLine("GeoCode Response is :"+geocodeResponse);
if (geocodeResponse.Results.Count() > 0)
text1 = geocodeResponse.Results[0].DisplayName;
else
text1 = "No Results found";
textBlock1.Text = text1;
System.Diagnostics.Debug.WriteLine("Location is :"+text1);
}
The following blog post should assist you :-
http://www.nickharris.net/2010/12/how-to-reverse-geocode-a-location-to-an-address-on-windows-phone-7/
Unfortunately, the CivicAddressResolver is currently not implemented on Windows Phone so you would have to use an online based solution.