How to zoom to multiple shapes

255
4
10-23-2013 07:28 AM
Highlighted
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?
Reply
0 Kudos
4 Replies
Highlighted
MVP Honored Contributor
IEnvelope has a Union method. You can loop through all the features and union their extents. See this post as an example
Reply
0 Kudos
Highlighted
New Contributor II
This looks promising.  I'll take it for a spin and see what I come up with.
Reply
0 Kudos
Highlighted
New Contributor II
Yep, that did the trick.  Thanks much!
Reply
0 Kudos
Highlighted
MVP Honored Contributor
Glad to hear that. Please don't forget to click the check mark to signify your question was answered.
Reply
0 Kudos