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 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
add comment

2 Answers

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
add comment

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

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.