How to zoom to multiple shapes

497
4
10-23-2013 07:28 AM
DaveSouthern
New Contributor II
I have a situation where the user want to be able to select several shapes via a grid (the shape records having been previously loaded into a database) and then have the map display zoom to the selected shapes.  I have this working with a single shape by simply setting the map extent to the iEnvelope of the shape.  But how do I do this for multiple shapes?  Is there a way to get the envelope for a group of shapes on a map?
0 Kudos
4 Replies
KenBuja
MVP Esteemed Contributor
IEnvelope has a Union method. You can loop through all the features and union their extents. See this post as an example
0 Kudos
DaveSouthern
New Contributor II
This looks promising.  I'll take it for a spin and see what I come up with.
0 Kudos
DaveSouthern
New Contributor II
Yep, that did the trick.  Thanks much!
0 Kudos
KenBuja
MVP Esteemed Contributor
Glad to hear that. Please don't forget to click the check mark to signify your question was answered.
0 Kudos