I use GeocodeQuery to look up the coordinates of a search term.

// Get your current position
var myPosition = await new Geolocator().GetGeopositionAsync(TimeSpan.FromMinutes(1), TimeSpan.FromSeconds(10));

// Define search
var geoQuery = new GeocodeQuery();
geoQuery.SearchTerm = "Taipei";
geoQuery.GeoCoordinate = new GeoCoordinate(myPosition.Coordinate.Latitude, myPosition.Coordinate.Longitude);
geoQuery.QueryCompleted += (s, e) => {
  if (e.Error == null && e.Result.Count > 0) {
    // e.Result will contain a list of coordinates of matched places.
    // You can show them on a map control , e.g.
    myMap.Center = e.Result[0].GeoCoordinate;
    myMap.ZoomLevel = 2;
  }
}
geoQuery.QueryAsync();

It works well! I got some location about "Taipei" successfully,

But, when I search "Taipei" in tranditional chinese "台北",

I got nothing in callback function geoQuery.QueryCompleted,

e.Result.Count = 0

How should I handle the GeocodeQuery search in different language?? Thanks for any help!

有帮助吗?

解决方案

The geocodequery use the system language to perform search. If you change your phone language to Chinese you should get results.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top