//获取导航Provider,如果当前Map的Provider不支持导航,那么调用默认OpenStreetMap
            RoutingProvider routingProvider =
       mapControl.MapProvider as RoutingProvider ?? GMapProviders.OpenStreetMap;

            MapRoute route = routingProvider.GetRoute(
                new PointLatLng(35.834914, -76.009508), //起始点
                new PointLatLng(35.854914, -76.009508), //结束点
                false, //是否高速
                false, //步行模式
                (int)mapControl.Zoom);

            GMapRoute gmRoute = new GMapRoute(route.Points);

            mapControl.Markers.Add(gmRoute);

 

发表评论

电子邮件地址不会被公开。 必填项已用*标注