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.

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

1 Answer 1

up vote 3 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 (tinyurl.com/298khqo) –  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

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.