Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/61.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Windows phone 8 Windows Phone 8从GPS位置获取城镇名称_Windows Phone 8_Gps_Maps_Bing Maps - Fatal编程技术网

Windows phone 8 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&

我正在windows phone 8中做一个应用程序,我需要一个函数,可以从GPS坐标返回地区、城镇地区或村庄的名称。如果他不通过手机上的地图上网,那就最好了。感谢您的回复和时间

/// <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。