Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I use the following line of code to define the extent setting of the environments GP.Extent = "144566.589424822 351191.130242809 145772.160224822 353810.742942809". However, I need to define it programmatically via the boundaries of a layer like the procedure is carried out in any relevant window (e.g. in Clip window) :'Environments'-'General Settings'-'Extent'-'Same as layer...'. Thanks Demetris

share|improve this question
up vote 1 down vote accepted

You can use the following code to find the rectangular extent of a feature. This will format it to a string you can use as an input to a geoprocessing tool or use it to set GP.Extent.

Dim pEnvelope As IEnvelope = pFeature.Shape.Envelope
Dim rectangle As String = ""
rectangle &= pEnvelope.XMin & " " & pEnvelope.YMin & " " & pEnvelope.XMax & " " & pEnvelope.YMax
share|improve this answer
Ok. Thanks for the answer. – Demetris Oct 18 '11 at 5:40

The interface IGeoDataset can be used to return the extent of a layer.

share|improve this answer

Your Answer


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.