Select to view content in your preferred language

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

508
0
05-13-2013 03:47 PM
Imihiro
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?
     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 would be appreciated.

Here is my 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?
........
}
0 Kudos
0 Replies