getRoutePointsForRoute

getRoutePointsForRoute

绘制路线后,我想使用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());
    }


}

最佳答案

请求路线时必须设置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];

关于android - 错误getRoutePointsForRoute,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/25845652/

10-10 18:35