Windows phone 8 Windows Phone 8从GPS位置获取城镇名称
我正在windows phone 8中做一个应用程序,我需要一个函数,可以从GPS坐标返回地区、城镇地区或村庄的名称。如果他不通过手机上的地图上网,那就最好了。感谢您的回复和时间Windows phone 8 Windows Phone 8从GPS位置获取城镇名称,windows-phone-8,gps,maps,bing-maps,Windows Phone 8,Gps,Maps,Bing Maps,我正在windows phone 8中做一个应用程序,我需要一个函数,可以从GPS坐标返回地区、城镇地区或村庄的名称。如果他不通过手机上的地图上网,那就最好了。感谢您的回复和时间 /// <summary> /// Returns the name of the village /// </summary> /// <param name="geoCoordinate">GPS coordinate</param> /// <returns&
/// <summary>
/// Returns the name of the village
/// </summary>
/// <param name="geoCoordinate">GPS coordinate</param>
/// <returns>returns the name of the village</returns>
string NameOfPlace(GeoCoordinate geoCoordinate)
{
}
//
///返回村庄的名称
///
///GPS坐标
///返回村庄的名称
位置的字符串名称(地理坐标地理坐标)
{
}
您可以使用获取有关当前位置的信息,但它不能脱机工作
要获取信息,请使用以下代码行:
string NameOfPlace = "";
ReverseGeocodeQuery MyReverseGeocodeQuery = null;
void GetNameOfPlace(GeoCoordinate geoCoordinate)
{
MyReverseGeocodeQuery = new ReverseGeocodeQuery();
MyReverseGeocodeQuery.GeoCoordinate = new GeoCoordinate(geoCoordinate.Latitude, geoCoordinate.Longitude);
MyReverseGeocodeQuery.QueryCompleted += ReverseGeocodeQuery_QueryCompleted;
MyReverseGeocodeQuery.QueryAsync();
}
private void ReverseGeocodeQuery_QueryCompleted(object sender, QueryCompletedEventArgs<IList<MapLocation>> e)
{
var result = e.Result[0];
NameOfPlace = result.Information.Address.Street + " " + result.Information.Address.City + " " + result.Information.Address.Country;
}
字符串NameOfPlace=”“;
ReverseGeocodeQuery MyReverseGeocodeQuery=null;
void GetNameOfPlace(地理坐标地理坐标)
{
MyReverseGeocodeQuery=新建ReverseGeocodeQuery();
MyReverseGeocodeQuery.GeoCoordinate=新的地理坐标(GeoCoordinate.Latitude、GeoCoordinate.Longitude);
MyReverseGeocodeQuery.QueryCompleted+=ReverseGeocodeQuery\u QueryCompleted;
MyReverseGeocodeQuery.QueryAsync();
}
私有void ReverseGeocodeQuery\u QueryCompleted(对象发送方,QueryCompletedEventArgs e)
{
var结果=e.result[0];
name of place=result.Information.Address.Street+“”+result.Information.Address.City+“”+result.Information.Address.Country;
}
地理坐标48.774010和9.224396的结果将是德国斯图加特的祖尔·斯塔博赫
顺便说一句:手机的本地化正在使用中(如果语言是德语,结果将是Zur Staibhöhe Stuttgart Deutschland)没有离线的API。