Select to view content in your preferred language

Zoom To Extent of Selected Graphics in a FeatureLayer

3721
2
10-16-2012 01:30 PM
MichelleMestrovich
Deactivated User
Is it possible to zoom to the extent of the selected graphics in a Featurelayer?  I know I can get to each geometry of the selected graphics, but how do I put all the geometiries into one collection and get their overall extents.

Thanks
0 Kudos
2 Replies
by Anonymous User
Not applicable
Original User: dbroux

You can calculate the Union of all the graphic geometry extents.

Using LINQ :

Envelope selectedGraphicsExtent = layer.SelectedGraphics.Select(g => g.Geometry.Extent)
                                                      .Aggregate((result, extent) => extent.Union(result));
0 Kudos
MichelleMestrovich
Deactivated User
Thanks, that worked perfectly. :cool:
0 Kudos