AnsweredAssumed Answered

polygonBarriers Route Analysis Problem

Question asked by svancise2 on Jul 30, 2012
Latest reply on Jul 30, 2012 by svancise2

We are trying to implement the route analysis tool in our app. So far we can complete routes when there are just stops put into the analysis but as soon as we add barriers we get the following error:

Error Domain=NSCocoaErrorDomain Code=400 "Unable to complete operation." UserInfo=0xfe93f20 {NSLocalizedFailureReason='polygonBarriers' parameter is invalid, NSURL=, NSLocalizedDescription=Unable to complete operation.}

Below is the code we are attempting to use to add barriers which is slightly based off of the routing sample online.

 NSMutableArray *barrierGraphics = [[NSMutableArray alloc] init ];         incidents_barriers = [[AGSGraphicsLayer alloc] init ];         [self.mapView addMapLayer:incidents_barriers withName:@"Incident Barriers"];         for(i=0;i<[ count];i++)         {             double x = ((AGSGraphic *)[ objectAtIndex:i]);             double y = ((AGSGraphic *)[ objectAtIndex:i]);             AGSSymbol *symbol;             symbol = [self barrierSymbol];             NSMutableDictionary *attributes = [[NSMutableDictionary alloc] init];             [attributes setValue:[NSNumber numberWithInt:i+1] forKey:@"barrierNumber"];             AGSEnvelope *env = [AGSEnvelope envelopeWithXmin:x-0.001 ymin:y-0.001 xmax:x+0.001 ymax:y+0.001 spatialReference:[AGSSpatialReference spatialReferenceWithWKID:4326]];             AGSGraphic *tempBarrier = [AGSGraphic graphicWithGeometry:env symbol:symbol attributes:nil infoTemplateDelegate:self];             tempBarrier.attributes = attributes;             [incidents_barriers addGraphic:tempBarrier];             [barrierGraphics addObject:tempBarrier];             [incidents_barriers dataChanged];         }         [params setPolygonBarriersWithFeatures:barrierGraphics];         params.ignoreInvalidLocations = YES;         [task solveWithParameters:params];