1

绘制路线后,我想使用 SKOBBLER 的 SKRouteManager 类中的函数 getRoutePointsforRoute 获取路线的点。该函数返回一个 SKCoordinates 列表,但它们都是零。

public void onAllRoutesCompleted() {
    List<SKCoordinate> list_coordinates = SKRouteManager.getInstance().getRoutePointsForRoute(idRoute);
    for(int i=0; i< list_coordinates.size();i++)
    {
     Log.d(LOG_TAG,i+" -> "+ list_coordinates.get(i).toString());
    }

}

4

1 回答 1

2

请求路线时必须设置 requestExtendedRoutePointsInfo - 请求路线时必须设置 requestExtendedRoutePointsInfo - 这样您将获得所有路线点的坐标。这是一个例子:

        SKRouteSettings* route = [[SKRouteSettings alloc]init];
        route.startCoordinate=CLLocationCoordinate2DMake(37.9667, 23.7167);
        route.destinationCoordinate=CLLocationCoordinate2DMake(37.9677, 23.7567);
        route.shouldBeRendered = YES; // If NO, the route will not be rendered.
        route.requestAdvices = YES;
        route.numberOfRoutes = 1;
        route.requestExtendedRoutePointsInfo = YES;
        [[SKRoutingService sharedInstance] calculateRoute:route];
于 2014-09-15T11:18:54.350 回答