I am trying to pass the output of a route task into a geoprocessing service. I believe I need to take the route result (event.routeSolveResult.routeResults[0]) and (maybe/possibly) convert that to a feature set, then pass the feature set to the geoprocessing service as a parameter. How can this be accomplished?
Or is there a way to convert the graphic layer returned from the route task into a feature set, and pass this to the geoprocessing service?
I have tried to create an array collection from the graphic layer returned from the route task (code below) and I have tried to pass event.routeSolveResult.routeResult[0] to locatorParams.Route (not shown). All efforts have yielded an HTTP Request Error [IOError].
Thanks for any help you can provide!
private function barricadelocator():void
{
var arrColl:ArrayCollection = new ArrayCollection();
for(var i:int = 0; i<graphicsLayer_Route.numGraphics; i++)
{
var gra:Graphic = graphicsLayer_Route.graphicProvider;
arrColl.addItem(gra);
}
var locatorFS:FeatureSet = new FeatureSet();
locatorFS.features = arrColl.source;
locatorFS.geometryType = Geometry.POLYLINE;
locatorFS.spatialReference = new SpatialReference(4269);
var locatorParams:Object = new Object();
locatorParams.Route = locatorFS;
locator.disableClientCaching = true;
locator.outSpatialReference = map.spatialReference;
locator.useAMF = false;
locator.addEventListener(GeoprocessorEvent.EXECUTE_COMPLETE, locatorCompleteHandler,false,0,true);
locator.addEventListener(FaultEvent.FAULT, barricadefaultHandler,false,0,true);
locator.submitJob(locatorParams);
//locator.execute(locatorParams);
}