Edit: added clip_analysis to generate the final polygons to use in SelectLayerByLocation process.
I think the best solution I've tested so far is to break up the polygon into individual polygons and then iterating over each polygon to perform the SelectbyLocation on the point features, checking to see if any features fall inside, then break out of that loop if that's the case.
Pretty straight forward:
1. CreateFishnet_management of the polygon feature.
2. FeatureToPolygon_management of the output Fishnet
3. Search cursor loop over each polygon in the fishnet
4. SelectLayerByLocation and perform test to count result.
5. If count > 0 then break and return with Boolean TRUE
What's interesting and the challenge is that the combination of rows/cols for the fishnet vs. the overall size of the input polygon geometry will determine the efficiency of the overall process. That is, if it's a large input polygon and too many rows/cols are created for the fishnet, then it will take longer to loop, but it also takes less time to SelectLayerByLocation.
There's a direct correlation between the content of the fishnet vs. the processing time of the SelectLayerByLocation. That is, if the faster it finds points within one of the fishnet polygons, the faster the overall process.
This beats any straight-up SelectLayerByLocation call against the full extent of the original point / polygon feature classes!
arcpy.MakeFeatureLayer_management(pnt_fc, "PointFeatures")
extent = polygon.extent
originXY = extent.lowerLeft
yaxisXY = extent.upperLeft
opp_corner =extent.upperRight
print "origin: " + str(originXY)
print "yaxis: " + str(yaxisXY)
print "opposite corner: " + str(opp_corner)
cellWidth = 0
cellHeight = 0
nrows = 4
ncols = 4
outFC = r'in_memory\outsections_line'
outFishnet = r'in_memory\outsections'
outClip = r'in_memory\clipfeatures'
arcpy.CreateFishnet_management(outFC, str(originXY), str(yaxisXY), cellWidth, cellHeight, nrows, ncols, str(opp_corner))
arcpy.FeatureToPolygon_management(outFC, outFishnet)
arcpy.Clip_analysis(outFishnet, polygon, outClip)
with arcpy.da.SearchCursor(outClip, ['SHAPE@']) as outcur:
for outrow in outcur:
tshape = outrow[0]
arcpy.SelectLayerByLocation_management("PointFeatures", "INTERSECT", tshape)
rowcounter = int(arcpy.GetCount_management("PointFeatures").getOutput(0))
if rowcounter > 0:
print "rowcounter: " + str(rowcounter)
return True
break
else:
print "rowcounter: " + str(rowcounter)