2013-09-24 20 views
0

我试着去实现一个按钮,点击后填充的Windows Phone 8:获取最新地址 - 数据(从当前位置)

  • 纬度
  • 经度
  • Streetnumber
  • 邮编
  • 城市

myGeoposition.CivicAddress。给我城市和邮政编码

myGeoposition.Coordinate。给我拉蒂/经度

我在哪里得到休息?

我使用的地图控制(未兵地图!)来自:Microsoft.Phone.Maps.Controls;装配= Microsoft.Phone.Maps

try 
     { 
      Geolocator geolocator = new Geolocator(); 
      geolocator.DesiredAccuracy = PositionAccuracy.Default; 
      IAsyncOperation<Geoposition> locationTask = null; 

      try 
      { 
       locationTask = geolocator.GetGeopositionAsync(TimeSpan.FromMinutes(1), TimeSpan.FromSeconds(15)); 
       Geoposition myGeoposition = await locationTask; 
       Geocoordinate myGeocoordinate = myGeoposition.Coordinate; 

       GeoCoordinate myGeoCoordinate = 
       CoordinateConverter.ConvertGeocoordinate(myGeocoordinate); 

回答

3

可以使用ReverseGeocodeQuery class摆脱信息一个位置:

MapAddress address; 
ReverseGeocodeQuery query = new ReverseGeocodeQuery(); 
query.GeoCoordinate = myGeoCoordinate; 
query.QueryCompleted += (s, e) => 
    { 
     if (e.Error != null) 
      return; 

     address = e.Result[0].Information.Address; 
    }; 
query.QueryAsync();