Windows Phone 8에서 Maps API를 사용하여 현재 위치에서 Foursquare 또는 Google Maps와 비슷한 장소 이름을 가져오고 싶습니다. 이미 this 자습서의 코드를 사용하여 현재 위치를 가져올 수 있습니다.Windows Phone 8에서 Nokia Maps의 장소 이름을 얻는 방법은 무엇입니까?
아무도 도와 줄 수 있습니까?
Windows Phone 8에서 Maps API를 사용하여 현재 위치에서 Foursquare 또는 Google Maps와 비슷한 장소 이름을 가져오고 싶습니다. 이미 this 자습서의 코드를 사용하여 현재 위치를 가져올 수 있습니다.Windows Phone 8에서 Nokia Maps의 장소 이름을 얻는 방법은 무엇입니까?
아무도 도와 줄 수 있습니까?
ReverseGeocodeQuery 클래스를 사용할 수 있습니다.
var rgc = new ReverseGeocodeQuery();
rgc.QueryCompleted += rgc_QueryCompleted;
rgc.GeoCoordinate = myGeoCoord; //or create new gc with your current lat/lon info
rgc.QueryAsync();
그런 다음에 전달 된 이벤트 인수의 Result 속성을 사용하여 rgc_QueryCompleted
이벤트 핸들러 내에서 데이터를 얻을 수 있습니다.
@keyboardP의 대답은 충분하지 않았다, 여기 (희망) 작업 예제 귀하의 위치에 대한 정보를 얻으십시오. 최소한 API의 측면에서는 볼 수없는 '이름'속성이 없습니다. 이를 위해
public async Task<MapLocation> ReverseGeocodeAsync(GeoCoordinate location)
{
var query = new ReverseGeocodeQuery { GeoCoordinate = location };
if (!query.IsBusy)
{
var mapLocations = await query.ExecuteAsync();
return mapLocations.FirstOrDefault();
}
return null;
}
는
public static class GeoQueryExtensions
{
public static Task<T> ExecuteAsync<T>(this Query<T> query)
{
var taskSource = new TaskCompletionSource<T>();
EventHandler<QueryCompletedEventArgs<T>> handler = null;
handler = (sender, args) =>
{
query.QueryCompleted -= handler;
if (args.Cancelled)
taskSource.SetCanceled();
else if (args.Error != null)
taskSource.SetException(args.Error);
else
taskSource.SetResult(args.Result);
};
query.QueryCompleted += handler;
query.QueryAsync();
return taskSource.Task;
}
}
당신이 날이에 대한 자세한 내용을 설명 할 수있다 (compiledexperience.com blog)에서 비동기 쿼리에 대한 다음과 같은 확장 메서드를 추가해야 작동하려면? – albilaga
무엇을 알고 싶습니까? 이것은 단순히 새로운 객체를 생성하고, 이벤트 핸들러를 첨부하여 완료 시점을 확인하고, 좌표를 찾아서 프로세스를 시작하는 것입니다. – keyboardP