Solved! Go to Solution.
import arcpy from arcpy import env from arcpy import mapping mxd = mapping.MapDocument("CURRENT") df = mapping.ListDataFrames(mxd)[0] #create polygon from data frame extent XMAX = df.extent.XMax XMIN = df.extent.XMin YMAX = df.extent.YMax YMIN = df.extent.YMin pnt1 = arcpy.Point(XMIN, YMIN) pnt2 = arcpy.Point(XMIN, YMAX) pnt3 = arcpy.Point(XMAX, YMAX) pnt4 = arcpy.Point(XMAX, YMIN) array = arcpy.Array() array.add(pnt1) array.add(pnt2) array.add(pnt3) array.add(pnt4) array.add(pnt1) polygon = arcpy.Polygon(array) #select features that intersect polygon arcpy.SelectLayerByLocation_management("Airports", "INTERSECT", polygon)
import arcpy from arcpy import env from arcpy import mapping mxd = mapping.MapDocument("CURRENT") df = mapping.ListDataFrames(mxd)[0] #create polygon from data frame extent XMAX = df.extent.XMax XMIN = df.extent.XMin YMAX = df.extent.YMax YMIN = df.extent.YMin pnt1 = arcpy.Point(XMIN, YMIN) pnt2 = arcpy.Point(XMIN, YMAX) pnt3 = arcpy.Point(XMAX, YMAX) pnt4 = arcpy.Point(XMAX, YMIN) array = arcpy.Array() array.add(pnt1) array.add(pnt2) array.add(pnt3) array.add(pnt4) array.add(pnt1) polygon = arcpy.Polygon(array) #select features that intersect polygon arcpy.SelectLayerByLocation_management("Airports", "INTERSECT", polygon)
mxd = arcpy.mapping.MapDocument("CURRENT") df = arcpy.mapping.ListDataFrames(mxd)[0] extent = df.extent grids = arcpy.da.SearchCursor("Clip_Grid",("SHAPE@","PageName")) for grid in grids: if (extent.contains(grid[0])) or (extent.overlaps(grid[0])) or (extent.within(grid[0])): print grid[1]