Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have a bunch of IPoints. I need an extent which contains all of them. Is there a quick way to do it? I had the idea of converting them to screen coordinates and then figuring it out manually but that seems like the wrong way to do it.

share|improve this question
add comment

2 Answers 2

up vote 5 down vote accepted

I'd leverage IEnvelope.Union. All IGeometry objects have an envelope, including points.

Here's some pseudocode:

envelope e = null
Foreach point
   if e == null then
      e = point.Envelope
   else
      e.Union(point.Envelope)
   end if
next point
share|improve this answer
add comment

I usually do it Kirk's way, but you could add them to a geometry bag and get the extent:

http://help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/index.html#//002m000001s8000000

http://forums.esri.com/Thread.asp?c=93&f=992&t=114648

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.