C# 在WindowsPhone8中,当我在地图中的任何位置点击时,我会检索晶格度、经度和特定位置的名称
我在我的windows-phone-8项目中有C# 在WindowsPhone8中,当我在地图中的任何位置点击时,我会检索晶格度、经度和特定位置的名称,c#,windows-phone-8,windows-phone,maps,here-api,C#,Windows Phone 8,Windows Phone,Maps,Here Api,我在我的windows-phone-8项目中有 XAML代码: <Controls:Map x:Name="MyMap" Tap="MyMap_Tap"/> 我还需要得到这个职位的名称,加上它的长度和纬度,所以我如何才能做到这一点 谢谢您可以使用反向地理编码将坐标转换为地址: private void Maps_ReverseGeoCoding(object sender, RoutedEventArgs e) { ReverseGeocodeQuery query = n
XAML代码:
<Controls:Map x:Name="MyMap" Tap="MyMap_Tap"/>
我还需要得到这个职位的名称,加上它的长度和纬度,所以我如何才能做到这一点
谢谢您可以使用反向地理编码将坐标转换为地址:
private void Maps_ReverseGeoCoding(object sender, RoutedEventArgs e)
{
ReverseGeocodeQuery query = new ReverseGeocodeQuery()
{
GeoCoordinate = new GeoCoordinate(YourLatitude, YourLongitude)
};
query.QueryCompleted += query_QueryCompleted;
query.QueryAsync();
}
void query_QueryCompleted(object sender, QueryCompletedEventArgs<IList<MapLocation>> e)
{
StringBuilder placeString = new StringBuilder();
foreach (var place in e.Result)
{
placeString.AppendLine(place.GeoCoordinate.ToString());
placeString.AppendLine(place.Information.Name);
placeString.AppendLine(place.Information.Description);
placeString.AppendLine(place.Information.Address.BuildingFloor);
placeString.AppendLine(place.Information.Address.BuildingName);
placeString.AppendLine(place.Information.Address.BuildingRoom);
placeString.AppendLine(place.Information.Address.BuildingZone);
placeString.AppendLine(place.Information.Address.City);
placeString.AppendLine(place.Information.Address.Continent);
placeString.AppendLine(place.Information.Address.Country);
placeString.AppendLine(place.Information.Address.CountryCode);
placeString.AppendLine(place.Information.Address.County);
placeString.AppendLine(place.Information.Address.District);
placeString.AppendLine(place.Information.Address.HouseNumber);
placeString.AppendLine(place.Information.Address.Neighborhood);
placeString.AppendLine(place.Information.Address.PostalCode);
placeString.AppendLine(place.Information.Address.Province);
placeString.AppendLine(place.Information.Address.State);
placeString.AppendLine(place.Information.Address.StateCode);
placeString.AppendLine(place.Information.Address.Street);
placeString.AppendLine(iplaceem.Information.Address.Township);
}
MessageBox.Show(placeString.ToString());
}
private void Maps\u反向编码(对象发送方、路由目标方)
{
ReverseGeocodeQuery=新建ReverseGeocodeQuery()
{
地理坐标=新的地理坐标(纬度、经度)
};
query.QueryCompleted+=query\u QueryCompleted;
query.QueryAsync();
}
无效查询\u QueryCompleted(对象发送方,QueryCompletedEventArgs e)
{
StringBuilder placeString=新的StringBuilder();
foreach(e.Result中的var位置)
{
AppendLine(place.geocordinate.ToString());
placeString.AppendLine(place.Information.Name);
AppendLine(place.Information.Description);
AppendLine(place.Information.Address.BuildingFloor);
AppendLine(place.Information.Address.BuildingName);
AppendLine(place.Information.Address.BuildingRoom);
AppendLine(place.Information.Address.BuildingZone);
AppendLine(place.Information.Address.City);
AppendLine(place.Information.Address.Continent);
AppendLine(place.Information.Address.Country);
AppendLine(place.Information.Address.CountryCode);
AppendLine(place.Information.Address.country);
AppendLine(place.Information.Address.District);
AppendLine(place.Information.Address.HouseNumber);
AppendLine(place.Information.Address.neighbority);
placeString.AppendLine(place.Information.Address.PostalCode);
AppendLine(place.Information.Address.Province);
AppendLine(place.Information.Address.State);
AppendLine(place.Information.Address.StateCode);
AppendLine(place.Information.Address.Street);
AppendLine(iplaceem.Information.Address.town);
}
Show(placeString.ToString());
}
谢谢它运行得很好:)
private void Maps_ReverseGeoCoding(object sender, RoutedEventArgs e)
{
ReverseGeocodeQuery query = new ReverseGeocodeQuery()
{
GeoCoordinate = new GeoCoordinate(YourLatitude, YourLongitude)
};
query.QueryCompleted += query_QueryCompleted;
query.QueryAsync();
}
void query_QueryCompleted(object sender, QueryCompletedEventArgs<IList<MapLocation>> e)
{
StringBuilder placeString = new StringBuilder();
foreach (var place in e.Result)
{
placeString.AppendLine(place.GeoCoordinate.ToString());
placeString.AppendLine(place.Information.Name);
placeString.AppendLine(place.Information.Description);
placeString.AppendLine(place.Information.Address.BuildingFloor);
placeString.AppendLine(place.Information.Address.BuildingName);
placeString.AppendLine(place.Information.Address.BuildingRoom);
placeString.AppendLine(place.Information.Address.BuildingZone);
placeString.AppendLine(place.Information.Address.City);
placeString.AppendLine(place.Information.Address.Continent);
placeString.AppendLine(place.Information.Address.Country);
placeString.AppendLine(place.Information.Address.CountryCode);
placeString.AppendLine(place.Information.Address.County);
placeString.AppendLine(place.Information.Address.District);
placeString.AppendLine(place.Information.Address.HouseNumber);
placeString.AppendLine(place.Information.Address.Neighborhood);
placeString.AppendLine(place.Information.Address.PostalCode);
placeString.AppendLine(place.Information.Address.Province);
placeString.AppendLine(place.Information.Address.State);
placeString.AppendLine(place.Information.Address.StateCode);
placeString.AppendLine(place.Information.Address.Street);
placeString.AppendLine(iplaceem.Information.Address.Township);
}
MessageBox.Show(placeString.ToString());
}