AnsweredAssumed Answered

Nested identifyTask works only when at max zoom level

Question asked by jtrappet2010 on Oct 14, 2013
Latest reply on Nov 8, 2013 by njarecha-esristaff
I have a strange issue.  I am using SDK 7.0 and 10.1.1 Update 2.  This same issue was present before I moved to 7.0, back on 6 as well however.

I have code that does an identify on a dynamic service layer.  When the results are returned, if they are empty, then it automatically does a new identify on another dynamic service layer.  This workflow is so that if there is something turned on in the top layer, the Identify will return from that layer, but if there wasn't something in that service where the user picked, then it will move down to the next layer and return results from there.

This is working just fine, but only if I'm zoomed all the way in to the map.  The original identify works no matter what my zoom level is, but the second identify only seems to work if I'm zoomed in all the way.  Also, if I pick while zoomed out, and the second identify fires, then I zoom in, the popup will show up once I zoom all the way in, and it will stay if I zoom back out.

Here's the code (I left out parts that don't seem important):
@synthesize identifyTask = _identifyTask,identifyParams=_identifyParams; @synthesize identifyTaskBase = _identifyTaskBase,identifyParamsBase=_identifyParamsBase;  - (void)viewDidLoad {     [super viewDidLoad];     self.mapView.touchDelegate = self;     self.mapView.calloutDelegate = self;     self.mapView.callout.delegate = self; ...     self.identifyTask = [AGSIdentifyTask identifyTaskWithURL:[NSURL URLWithString:@"http://****/ArcGIS/rest/services/CityMap/MapServer"]];     self.identifyTask.delegate = self;     self.identifyParams = [[AGSIdentifyParameters alloc] init];     self.identifyTaskBase = [AGSIdentifyTask identifyTaskWithURL:[NSURL URLWithString:@"http://****/arcgis/rest/services/BaseMap/GJMAP/MapServer"]];     self.identifyTaskBase.delegate = self;     self.identifyParamsBase = [[AGSIdentifyParameters alloc] init]; ... }  - (void)mapView:(AGSMapView *)mapView didClickAtPoint:(CGPoint)screen mapPoint:(AGSPoint *)mappoint graphics:(NSDictionary *)graphics {     self.mappoint = mappoint;     NSMutableArray *layerIDs = [NSMutableArray array];     for (AGSLayer *layer in self.mapView.mapLayers)     {         if([layer isKindOfClass:[AGSDynamicMapServiceLayer class]])         {             AGSDynamicMapServiceLayer *tempLayer = (AGSDynamicMapServiceLayer *)layer;             layerIDs = [tempLayer.visibleLayers mutableCopy];         }     }          self.identifyParams.layerIds = layerIDs;     self.identifyParams.tolerance = 8;     self.identifyParams.geometry = self.mappoint;     self.identifyParams.size = self.mapView.bounds.size;     self.identifyParams.mapEnvelope = self.mapView.visibleArea.envelope;     self.identifyParams.returnGeometry = YES;     self.identifyParams.layerOption = AGSIdentifyParametersLayerOptionTop;     self.identifyParams.spatialReference = self.mapView.spatialReference;      [self.identifyTask executeWithParameters:self.identifyParams]; }  - (void)identifyTask:(AGSIdentifyTask *)identifyTask operation:(NSOperation *)op didExecuteWithIdentifyResults:(NSArray *)results {     [self.graphicsLayer removeAllGraphics];     if ([results count] > 0)     {         AGSSymbol* symbol = [AGSSimpleFillSymbol simpleFillSymbol];         symbol.color = [UIColor colorWithRed:0 green:0 blue:1 alpha:0.5];         for (AGSIdentifyResult* result in results)         {             result.feature.symbol = symbol;             [self.graphicsLayer addGraphic:result.feature];         }         NSString *layerName = [((AGSIdentifyResult*)[results objectAtIndex:0]) layerName];         self.mapView.callout.title = layerName;         self.mapView.callout.detail = @"Click for more detail..";         [self.mapView.callout showCalloutAtPoint:self.mappoint forGraphic:((AGSIdentifyResult*)[results objectAtIndex:0]).feature animated:YES];     }     else     {         //do another identify on base layer (parcels etc)         self.identifyParamsBase.layerIds = @[@36,@37,@38,@39];         self.identifyParamsBase.tolerance = 8;         self.identifyParamsBase.geometry = self.mappoint;         self.identifyParamsBase.size = self.mapView.bounds.size;         self.identifyParamsBase.mapEnvelope = self.mapView.visibleArea.envelope;         self.identifyParamsBase.returnGeometry = YES;         self.identifyParamsBase.layerOption = AGSIdentifyParametersLayerOptionTop;         self.identifyParamsBase.spatialReference = self.mapView.spatialReference;                 //execute the task         [self.identifyTaskBase executeWithParameters:self.identifyParamsBase];     } }  - (void)identifyTaskBase:(AGSIdentifyTask *)identifyTaskBase operation:(NSOperation *)op didExecuteWithIdentifyResults:(NSArray *)results {     [self.graphicsLayer removeAllGraphics];     if ([results count] > 0)     {         AGSSymbol* symbol = [AGSSimpleFillSymbol simpleFillSymbol];         symbol.color = [UIColor colorWithRed:0 green:0 blue:1 alpha:0.5];         for (AGSIdentifyResult* result in results)         {             result.feature.symbol = symbol;             [self.graphicsLayer addGraphic:result.feature];         }         NSString *layerName = [((AGSIdentifyResult*)[results objectAtIndex:0]) layerName];         self.mapView.callout.title = layerName;         self.mapView.callout.detail = @"Click for more detail..";         [self.mapView.callout showCalloutAtPoint:self.mappoint forGraphic:((AGSIdentifyResult*)[results objectAtIndex:0]).feature animated:YES];     } }


Does anyone see anything directly wrong with this code?  What is baffling me is that it works fine if I am zoomed all the way in, but doesn't display properly otherwise.  Also the fact that if there is a layer turned on for the first identify to hit, that works at any zoom level, and it is set up the exact same way.

Thanks for any tips or help!
Jackson

Outcomes