加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

windows-phone-8 – windows phone 8 Map API GeocodeQuery.Sear

发布时间:2020-12-14 05:42:19 所属栏目:Windows 来源:网络整理
导读:我使用 GeocodeQuery来查找搜索词的坐标. // Get your current positionvar myPosition = await new Geolocator().GetGeopositionAsync(TimeSpan.FromMinutes(1),TimeSpan.FromSeconds(10));// Define searchvar geoQuery = new GeocodeQuery();geoQuery.Sea
我使用 GeocodeQuery来查找搜索词的坐标.

// 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();

它运作良好!我成功地获得了一些关于“台北”的位置,

但是,当我在传统的中文“台北”搜索“台北”时,

我在回调函数geoQuery.QueryCompleted中没有得到任何东西,

e.Result.Count = 0

我该如何处理不同语言的GeocodeQuery搜索?
谢谢你的帮助!

解决方法

geocodequery使用系统语言来执行搜索.如果您将手机语言更改为中文,则应获得结果.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读