why does routTask.solve(routePara,function(resultRoutes){}) only returns 1 route?

05-12-2013 04:31 AM
New Contributor II
Subway map published to network analysis service.
select A as start station, B as destination station.  then routeTask.solve(paras,function(resultRoutes){});
why only one route returned while obviously there are multiple routes?

Code snippets:
        var routeTask = new esri.tasks.RouteTask(networkService);
        var routeParas = new esri.tasks.RouteParameters();
        routeParas.outSpatialReference = map.spatialReference; //outspatialReference of rp
        routeParas.returnRoutes = true;
        routeParas.stops = new esri.tasks.FeatureSet(); //stops of rp, each stop is a esri.Grahic
        routeParas.stops.features.push(tempGra1); //start station
        routeParas.stops.features.push(tempGra2);//end station

        var routeSymbol = new esri.symbol.SimpleLineSymbol().setColor(new dojo.Color([0, 0, 255, 0.5])).setWidth(5);
        routeTask.solve(routeParas, function (solveResults) {
        alert(solveResults.routeResults.length);//always one route,why?

Any help will be appreciated.
Tags (2)
0 Kudos
1 Reply
New Contributor II
It has been recognized the routeTask.solve()  return the route of shortest distance by default.
    However,in many subway-transfer-route cases, a shortest distance route may cost more time than the second shortest distance route.
    How to get the second shortest distance route using the ArcGIS Javascript API 3.4?
    How to get the second shortest distance route using ArcGIS SDK?
    Any Help with interface name or code snippets would be appreciated.
    I'm Hinada.
0 Kudos