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 have to get an extent of a given raster so that I can save it and use the same to clip another raster with that extracted extent. As of now I am stuck in the extent part.

import arcpy
from arcpy import env

desc= arcpy.env.extent("D:\GIS @ UTD\Sem 1\GISC 6317\Lab\Lab 10\temp\Tahoe\Tahoe\Emer\erelev.grid")

print desc

The following gives an output 0 0 0 0 NaN NaN NaN NaN.

Any suggestions.

share|improve this question
up vote 12 down vote accepted

Dont use env.extent you need to get raster extent.

import arcpy

elevRaster ='C:/data/elevation')
myExtent = elevRaster.extent

print myExtent

i hope it helps you...

share|improve this answer

Senthil Saar,

Please use the following script, which should work... Please change the path as per the location (Either in Geodatabase or Folders). In this example 'congrd' is the raster dataset that I used.

import arcpy

from import *

elevRaster = Raster('C:/arcgis/ArcTutor/3DAnalyst/Exercise2/workspace2/congrd')

myExtent = elevRaster.extent

print myExtent

I hope this helps.

share|improve this answer
-1 This is effectively the same answer as the one posted by @Aragon. – Fezter Nov 22 '12 at 3:26
I tried yours and it failed...That is why I had posted the tweaked one...I guess "import arcpy" alone cannot do the trick. Sometimes we need a little push. – Jegan Somu Nov 23 '12 at 9:04
@JeganSomu You can always edit existing answer instead of creating barely different one. If you don't have enough points, your edits will be reviewed first. – mlt Jan 16 '14 at 17:00

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.