get bounding envelope for all graphics?

806
3
Jump to solution
11-04-2013 07:34 AM
MattCooper
Occasional Contributor
I'm trying to zoom to the extent of all map graphics (from 3 feature services), but I'm not seeing any easy helper methods to get the extents of all graphics of a featurelayer in the API.  I have a feeling I'm overlooking something obvious. I'm hoping to avoid iterating over each layers graphics object and recording the xmin, xmax, ymin, ymax across all 3 layers.

The context for this, is that I'm setting a definition expression for all the layers and want to zoom to the remaining graphics after the definition expression has been set.

Thanks for the help,
Matt
0 Kudos
1 Solution

Accepted Solutions
DiveshGoyal
Esri Regular Contributor
Nope. AGSFeatureLayerDidLoadFeaturesNotification is the way to go.

View solution in original post

0 Kudos
3 Replies
DiveshGoyal
Esri Regular Contributor
Have you tried using the fullEnvelope property of AGSFeatureLayer?
0 Kudos
MattCooper
Occasional Contributor
Thanks for the quick response.  I did initially look at fullEnvelope but it wasn't changing, so I assumed it wasn't honoring the definition expression.  However, that was because I was logging before the layer had refreshed.  So, fullEnvelope will work, but that leads to another question. 

Is there an appropriate notification that indicates all layers have been refreshed or would I need to monitor each layers AGSFeatureLayerDidLoadFeaturesNotification?

Thanks again!
Matt
0 Kudos
DiveshGoyal
Esri Regular Contributor
Nope. AGSFeatureLayerDidLoadFeaturesNotification is the way to go.
0 Kudos