【问题标题】:Android Yandex mapkit routeAndroid Yandex mapkit 路由
【发布时间】:2015-11-04 21:35:33
【问题描述】:

我使用 yandexmapkit-android 进行项目。图书馆链接是https://github.com/yandexmobile/yandexmapkit-android

文档非常薄弱,github页面不新鲜。最后一次更新是 3 年前。

我想在两点之间画出路线,但我找不到这个或示例的任何函数或方法

你能帮帮我吗?

【问题讨论】:

    标签: android mapkit yandex


    【解决方案1】:
    【解决方案2】:

    see yandex mapkit demo

     mtRouter = MapKitFactory.getInstance().createMasstransitRouter();
        mtRouter.requestRoutes(ROUTE_START_LOCATION, ROUTE_END_LOCATION,
                new MasstransitOptions(new ArrayList<String>(), new ArrayList<String>(),
                        // Specify departure time or arrival time here
                        new TimeOptions()),
                this);
    

    【讨论】:

      【解决方案3】:
      // add points
      List<RequestPoint> requestPoints = new ArrayList<>();  
      DrivingOptions drivingOptions = new DrivingOptions();   
      DrivingRouter drivingRouter = MapKitFactory.getInstance().createDrivingRouter();
                  DrivingSession drivingSession = drivingRouter.requestRoutes(
                      requestPoints, drivingOptions, new DrivingSession.DrivingRouteListener() {
                          @Override
                          public void onDrivingRoutes(List<DrivingRoute> routes) {
                              if (routes != null
                                  && !routes.isEmpty()) {
                                  DrivingRoute route = routes.get(0);
      
                              BoundingBox box = BoundingBoxHelper.getBounds(route.getGeometry());
                              CameraPosition boundingBoxPosition = yandexMap.getMap()
                                  .cameraPosition(box);
                          }
                      }
      
                      @Override
                      public void onDrivingRoutesError(Error error) {
                          //showErrorMessage                    }
                  });
      

      您可以轻松使用此方法并设置相机位置

      希望对你有用

      【讨论】:

        猜你喜欢
        • 2019-02-18
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-08-17
        相关资源
        最近更新 更多