Greetings,
I'm writing some arcpy to select polygons that contain the centroid of my current data frame extent. Here's my code:
The code runs without error, and the coordinates of myPt/myPtGeometry are correct. Yet, nothing gets selected.
Am I missing some coding step, or can you not use geometry this way?
Thanks,
Scott
I'm writing some arcpy to select polygons that contain the centroid of my current data frame extent. Here's my code:
Code:
import arcpy
mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd)[0]
myPt = arcpy.Point((df.extent.XMax+df.extent.XMin)/2, (df.extent.YMax+df.extent.YMin)/2)
myPtGeometry = arcpy.PointGeometry(myPt)
arcpy.SelectLayerByLocation_management ("DOQQImport", "COMPLETELY_CONTAINS", myPtGeometry)Am I missing some coding step, or can you not use geometry this way?
Thanks,
Scott