AnsweredAssumed Answered

polygonBarriers Route Analysis Problem

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

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=http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Network/USA/NAServer/Route/solve?f=json, 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<[incidents.graphics count];i++)         {             double x = ((AGSGraphic *)[incidents.graphics objectAtIndex:i]).geometry.envelope.center.x;             double y = ((AGSGraphic *)[incidents.graphics objectAtIndex:i]).geometry.envelope.center.y;             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];

Outcomes