Hi Luca,I'm fairly new at this, but this is how I did mine.#pragma mark AGSQueryTaskDelegate
//results are returned
- (void)queryTask:(AGSQueryTask *)queryTask operation:(NSOperation *)op didExecuteWithFeatureSetResult:(AGSFeatureSet *)featureSet
{
if ([featureSet.features count] == 0)
{
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Error"
message:@"Address not Found"
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alertView show];
}
else
{
AGSGraphic *graphic = [featureSet.features objectAtIndex:0];
AGSMutablePoint *pt = [graphic.geometry.envelope.center mutableCopy];
AGSMutableEnvelope *env = [graphic.geometry.envelope mutableCopy];
if (featureSet.geometryType == AGSGeometryTypePoint)
{
NSLog(@"point type");
float xMin = pt.x - 150.0;
float yMin = pt.y - 150.0;
float xMax = pt.x + 150.0;
float yMax = pt.y + 150.0;
AGSSpatialReference *sref = graphic.geometry.envelope.spatialReference;
AGSEnvelope *envAlt = [AGSEnvelope envelopeWithXmin:xMin ymin:yMin xmax:xMax ymax:yMax spatialReference:sref];
[self.mapView zoomToEnvelope:envAlt animated:YES];
}
else
{
[env expandByFactor:1.3];
[self.mapView zoomToEnvelope:env animated:YES];
}
}
}