Trying to get envelope information

1705
3
12-14-2011 12:28 PM
JerryChapman
New Contributor
Hi,
I'm new at this, I'm trying to get envelope information from a AGSFeatureSet.  My query works, it returns 1 object.  I also used the returnGeometry = YES in my setup of the query.  The problem I'm having is I cannot write the statement correctly to get the envelope information.  My statement keeps giving me an error when I add .geometry.  Here is the code:

- (void)queryTask:(AGSQueryTask *)queryTask operation:(NSOperation *)op didExecuteWithFeatureSetResult:(AGSFeatureSet *)featureSet
{
  
    AGSEnvelope *env = [((AGSFeatureSet*)[featureSet.features objectAtIndex:0]).geometry];
    [self.mapView zoomToEnvelope:env animated:YES];
   
}
Any help would be appreciated,

Jerry
0 Kudos
3 Replies
NimeshJarecha
Esri Regular Contributor
Your code should be...

AGSGraphic *graphic = [featureSet.features objectAtIndex:0];
AGSEnvelope *env = (AGSEnvelope *)graphic.geometry.envelope;

Regards,
Nimesh
0 Kudos
JerryChapman
New Contributor
Nimesh,
Thanks for the quick response.  Your solution worked great.  ESRI has always had excellent support for there products.

Jerry
0 Kudos
NimeshJarecha
Esri Regular Contributor
You're most welcome! 🙂

Regards,
Nimesh
0 Kudos