Windows phone 8 是否可以使用WP8上的诺基亚地图获取离我所在位置最近的城市?

Windows phone 8 是否可以使用WP8上的诺基亚地图获取离我所在位置最近的城市?,windows-phone-8,maps,reverse-geocoding,here-api,Windows Phone 8,Maps,Reverse Geocoding,Here Api,我可以在wp8上找到我的当前位置。然后,我尝试使用基于该位置的诺基亚地图进行地理编码,我总是得到奇怪的结果。没有人指向城市或类似的地方 我用于获取位置的代码: Geolocator geolocator = new Geolocator(); geolocator.DesiredAccuracyInMeters = 50; Geoposition position = await geolocator.GetGeopositionAsync(TimeSpan.FromMinutes(1), Ti

我可以在wp8上找到我的当前位置。然后,我尝试使用基于该位置的诺基亚地图进行地理编码,我总是得到奇怪的结果。没有人指向城市或类似的地方

我用于获取位置的代码:

Geolocator geolocator = new Geolocator();
geolocator.DesiredAccuracyInMeters = 50;
Geoposition position = await geolocator.GetGeopositionAsync(TimeSpan.FromMinutes(1), TimeSpan.FromSeconds(30));
MyCoordinate = new GeoCoordinate(position.Coordinate.Latitude, position.Coordinate.Longitude);
然后进行地理编码:

var geoQuery = new GeocodeQuery();
geoQuery.SearchTerm = "put city result of reverseGeoding for MyCoordinate";
geoQuery.QueryCompleted += geoQuery_QueryCompleted;
geoQuery.GeoCoordinate = geo;
geoQuery.QueryAsync();
下一步:

void geoQuery\u QueryCompleted(对象发送方,QueryCompletedEventArgs e)
{
如果(e.Error==null&&e.Result.Count>0)
{
}
}
e、 结果数组可以包含指向地球上某个位置的地理坐标,但并不总是接近坐标

是否可以使用WP8上的“诺基亚地图”获取距离我所在位置最近的城市?

您可以使用从地理坐标获取和地址:

ReverseGeocodeQuery=new ReverseGeocodeQuery();
query.geocordinate=mygeocordinate;
query.QueryCompleted+=query\u QueryCompleted;
query.QueryAsync();
您将获得一个
MapAddress
类型的对象,该对象具有许多属性,包括城市:

void query\u QueryCompleted(对象发送方,QueryCompletedEventArgs e)
{
如果(例如错误!=null)
返回;
MapAddress address=e.Result[0]。Information.address;
字符串city=address.city;
}
要使用此api,必须在WMAppManifest.xml文件中指定
ID\u CAP\u MAP
功能

void geoQuery_QueryCompleted(object sender, QueryCompletedEventArgs<IList<MapLocation>> e)
{
    if (e.Error == null && e.Result.Count > 0)
    {
    }
}