2016-06-22 3 views
-1

내 UI에지도를 포함 시켰으며 기기의 현재 위치에서 위치 (예 : 식당)까지의 경로를 표시하려고합니다. 어떻게해야합니까?지도 컨트롤에 경로를 그리려면 어떻게해야합니까?

+0

당신은 – cavpollo

+0

어떤지도를 시도 알려주세요? 무슨 일을하고 있니? IOS? 기계적 인조 인간? HTML 웹 페이지? Apple Watch? 구체적으로 기재하십시오. – Pang

답변

0

당신이보고있는 기술이 무엇인지 모르겠지만 Windows에서 그런 것을 원한다면 - UWP 플랫폼은 경로를 계산 한 다음 그 정보를지도에 표시합니다.

MapControlMapRouteFinder은 출발 GPS 위치에서 끝 GPS 위치까지의 경로를 계산하는 데 필요합니다. 결과에서 MapControl에 추가 할 수있는 MapRouteView을 만들 수 있습니다. appmanifestLocation 기능도 확인하시기 바랍니다. 이처럼 할 수있는 :

// get the user's consent to determine the location 
var status = await Geolocator.RequestAccessAsync(); 
if (status == GeolocationAccessStatus.Allowed) 
{ 
    // get the current position 
    Geolocator locator = new Geolocator() { DesiredAccuracy = PositionAccuracy.High }; 
    Geoposition pos = await locator.GetGeopositionAsync(); 
    BasicGeoposition current = new BasicGeoposition() 
      { Latitude = pos.Coordinate.Latitude, 
       Longitude = pos.Coordinate.Longitude }; 

    // set the lat/long of the restaurant 
    BasicGeoposition restaurant = new BasicGeoposition() 
      { Latitude = 51.91997, Longitude = 4.486515 }; 

    // get the driving route 
    MapRouteFinderResult route = 
      await MapRouteFinder.GetDrivingRouteAsync(new Geopoint(current), 
                 new Geopoint(restaurant), 
                 MapRouteOptimization.Time, 
                 MapRouteRestrictions.None); 
    // get the view and add it to the map 
    MapRouteView routeView = new MapRouteView(route.Route); 
    routeView.RouteColor = Windows.UI.Colors.Red; 
    TheMap.Routes.Add(routeView); 

    // change the view of the map to see the complete route 
    await TheMap.TrySetViewBoundsAsync(route.Route.BoundingBox, 
             null, MapAnimationKind.Default); 
} 
관련 문제