Question

I'm using ReverseGeocodeQuery class to get location names from coordinates:

ReverseGeocodeQuery query = new ReverseGeocodeQuery();
query.GeoCoordinate = new GeoCoordinate(latitude, longitude);
query.QueryCompleted += (sender, args) =>
{
    var result = args.Result[0].Information.Address;
    Location location = new Location(result.Street, result.City, result.State, result.Country);
};            
query.QueryAsync();

The problem is that results are returned in the system language of the phone. Since I am using place names for tagging purposes, I need all of them in same language, preferably in english.

I have tried by setting the CurrentCulture to en-US:

Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");

But I'm still getting the results in the language configured as system language.

Is ther any way to get the results from ReverseGeocodeQuery in desired language?

Was it helpful?

Solution

The results are always using the system language. Maybe you can save the name of the place and also the lat long, or use a translation service to translate to englis

OTHER TIPS

Just to complete Josue's answer. An alternative to get reverse geocode results in desided language is to use one of the public REST APIs that allow to specify it (e.g. Google or Nokia Here). While the use of them is simple and are very customizable, the downside is that it is necessary to register to the services in order to get the keys.

I have decided for using HERE's API. So, below you will find the code I have used to achieve the same result as using the code present in the question, but forcing the result to be in English:

using (HttpClient client = new HttpClient())
{
    string url = String.Format("http://reverse.geocoder.cit.api.here.com/6.2/reversegeocode.json"
                    + "?app_id={0}"
                    + "&app_code={1}"
                    + "&gen=1&prox={2},{3},100"
                    + "&mode=retrieveAddresses"
                    + "&language=en-US", 
                    App.NOKIA_HERE_APP_ID, App.NOKIA_HERE_APP_CODE, latitude.ToString(CultureInfo.InvariantCulture), longitude.ToString(CultureInfo.InvariantCulture));

    var response = await client.GetAsync(url);
    var json = await response.Content.ReadAsStringAsync();
    dynamic loc = JObject.Parse(json);               
    dynamic address = JObject.Parse(loc.Response.View[0].Result[0].Location.Address.ToString());

    string street = address.Street;
    string city = address.City;
    string state = address.State;
    string country = address.Country;

    Location location = new Location(street, city, state, country);
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top