Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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

The script I'm writing requires a specific attribute of the building polygon that the data frame extent is currently focused on. Is there a way to grab this data?

share|improve this question
up vote 4 down vote accepted

In ArcGIS 10, you can use arcpy.mapping to do this. It would look something like:

mapdoc = arcpy.mapping.MapDocument("current")
dataframe = arcpy.mapping.ListDataFrames(mapdoc, mapdoc.activeView)[0]
extent = dataframe.extent

You can then pass the extent in as parameters to GP tools etc.

share|improve this answer
After you've got the active extent, you can get feature attributes by using Select Layer By Location ( – scw Jul 31 '10 at 21:07
Where would I input the active extent in this tool? SelectLayerByLocation_management (in_layer, {overlap_type}, {select_features}, {search_distance}, {selection_type}) For overlap_type, I'm using COMPLETELY_WITHIN, but according to the documentation, I can only select features from the in_layer that are completely within a polygon, not an extent. – Tanner Aug 7 '10 at 21:22
As far as I know, it should still work as an input there. Try it out. – Jason Scheirer Aug 9 '10 at 11:33
The extent you process over is an ArcGIS environment variable. You can set that with python before you run whatever other tools you'll use. See… – Paulo Raposo Nov 2 '15 at 5:30

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.