首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Android Yandex mapkit路由

Android Yandex mapkit路由
EN

Stack Overflow用户
提问于 2015-08-12 18:22:39
回答 3查看 1.9K关注 0票数 3

我在yandexmapkit-android项目中工作。库链接为https://github.com/yandexmobile/yandexmapkit-android

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

我想在两个点之间绘制路径,但我找不到任何函数或方法来实现这一点或示例

你能帮我吗?

EN

回答 3

Stack Overflow用户

发布于 2016-04-06 00:48:37

Stack Overflow用户

发布于 2018-10-10 18:53:09

see yandex mapkit demo

代码语言:javascript
复制
 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);
票数 0
EN

Stack Overflow用户

发布于 2018-10-31 22:04:37

代码语言:javascript
复制
// 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                    }
            });

您可以很容易地使用此方法并设置相机位置

希望它能为你工作

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31962456

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档