2015-01-08 2 views
1

주소를 얻으려고하는 좌표가 있습니다. Windows Phone 8 Silverlight 응용 프로그램에서는 ReverseGeocodeQuery를 사용하여 주소를 가져 왔지만 WinRT에서는 지원되지 않는 것 같습니다.Windows 유니버셜 앱의 역 지오 코드

WinRT에서이 작업을 수행하는 적절한 방법은 무엇입니까?

답변

4

MapLocationFinder을 사용할 수 있습니다. 다음은 자주 사용하는 코드 조각입니다. 기본적으로 MapLocationFinder에 쿼리를 실행하고 검색이 성공했는지 확인합니다. 그런 다음 첫 번째 위치를 가져와 Town이 설정되어 있는지 확인합니다.

물론 result.Locations 이상의 사용자는 물론 모든 요소를 ​​검사 할 수 있습니다.

public static async Task<MapLocation> resolveLocationForGeopoint(Geopoint geopoint) 
{ 
    MapLocationFinderResult result = await MapLocationFinder.FindLocationsAtAsync(geopoint); 
    if (result.Status == MapLocationFinderStatus.Success) 
    { 
     if (result.Locations.Count != 0) 
      // Check if the result is really valid 
      if (result.Locations[0].Address.Town != "") 
       return result.Locations[0]; 
    } 
    return null; 
} 
+0

완벽하게 작동했습니다! 감사! –