Hi Nimesh,
Your sample code helped me quite a bit, thank you. I do have another question.
I am having difficulty with identifying more than one set of features.
Example:
I have two identify Tasks set up for two dynamic layers. I beleive that I have all of the tasks set up properly.
// identify Tasks
- (void)mapView:(AGSMapView *)mapView didClickAtPoint:(CGPoint)screen mapPoint:(AGSPoint *)mappoint graphics:(NSDictionary *)graphics {
//first Identify Task
self.wellidentifyParams.layerIds = [NSArray arrayWithObjects:[NSNumber numberWithInt:0], nil];
self.wellidentifyParams.tolerance = 10;
self.wellidentifyParams.geometry = mappoint;
self.wellidentifyParams.size = self.mapView.bounds.size;
self.wellidentifyParams.mapEnvelope = self.mapView.envelope;
self.wellidentifyParams.returnGeometry = YES;
self.wellidentifyParams.layerOption = AGSIdentifyParametersLayerOptionAll;
self.wellidentifyParams.spatialReference = self.mapView.spatialReference;
//Turn on network activity indicator using the AGSMapView class method
[AGSMapView showNetworkActivityIndicator:TRUE];
//execute the task
[self.wellidentifyTask executeWithParameters:self.wellidentifyParams];
//the layer we want is layer �??5�?? (from the map service doc)
self.leaseIdentifyParams.layerIds = [NSArray arrayWithObjects:[NSNumber numberWithInt:6], nil];
self.leaseIdentifyParams.tolerance = 1;
self.leaseIdentifyParams.geometry = mappoint;
self.leaseIdentifyParams.size = self.mapView.bounds.size;
self.leaseIdentifyParams.mapEnvelope = self.mapView.envelope;
self.leaseIdentifyParams.returnGeometry = YES;
self.leaseIdentifyParams.layerOption = AGSIdentifyParametersLayerOptionAll;
self.leaseIdentifyParams.spatialReference = self.mapView.spatialReference;
//Turn on network activity indicator using the AGSMapView class method
[AGSMapView showNetworkActivityIndicator:TRUE];
//execute the task
[self.leaseIdentifyTask executeWithParameters:self.leaseIdentifyParams];
}
- (void)identifyTask:(AGSIdentifyTask *)identifyTask operation:(NSOperation *)op didExecuteWithIdentifyResults:(NSArray *)results {
//Turn off network activity indicator
[AGSMapView showNetworkActivityIndicator:FALSE];
//clear previous results
//[self.wellgraphicsLayer removeAllGraphics];
AGSSymbol* symbol = [AGSSimpleMarkerSymbol simpleMarkerSymbol];
symbol.color = [UIColor colorWithRed:0 green:0 blue:1 alpha:0.5];
for (AGSIdentifyResult* result in results) {
result.feature.symbol = symbol;
[self.wellgraphicsLayer addGraphic:result.feature];
}
//call dataChanged on the graphics layer to redraw the graphics
[self.wellgraphicsLayer dataChanged];
//Turn off network activity indicator
[AGSMapView showNetworkActivityIndicator:FALSE];
//clear previous results
[self.leaseGraphicsLayer removeAllGraphics];
//add new results
AGSSymbol* fillSymbol = [AGSSimpleFillSymbol simpleFillSymbol];
fillSymbol.color = [UIColor colorWithRed:0 green:0 blue:1 alpha:0.5];
for (AGSIdentifyResult* result in results) {
result.feature.symbol = fillSymbol;
[self.leaseGraphicsLayer addGraphic:result.feature];
}
//call dataChanged on the graphics layer to redraw the graphics
[self.leaseGraphicsLayer dataChanged];
}
After looking at the code for a awhile it seems that the AGSSymbol is being redefined and as a result is not rendering.
I have also tried to control which graphic is drawn by using a segmented controller with an if statement.
if(((UISegmentedControl *)segmentIndex).selectedIndex ==0) {
.....AGSSymbol is AGSSimpleMarkerSymbol...
}else {
....AGSSymbol is AGSSimpleFillSybol....
any help would be greatly appreciated.
Thanks!