Hi
i have a problem
I developed an application that allows you to query a layer Dynamics. I would like to center the selected feature in the map.
Help me
thanks
Hi
i have a problem
I developed an application that allows you to query a layer Dynamics. I would like to center the selected feature in the map.
Help me
thanks

You can get the geometry of the selected feature and use AGSMapView's zoomToGeometry method to zoom to it.
Regards,
Nimesh
Hi Luca,
I'm fairly new at this, but this is how I did mine.
Code:#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]; } } }
Sorry
i'm a beginner. How can i get geometry of graphics Layer?
Please an example code


Luca,
If this issue is resolved then please mark thread as answered.
Regards,
Nimesh
Bookmarks