By Wayne Zhang, GIS Programmer Analyst, Marietta, Georgia, USA

Download the script.

Code Summary

Many times user wants to select features which have their centroids in another feature. For instance, to find parcel features have their centroids in the subdivision. Although there is a existing tool in ArcMap to do the query, there is a no such ArcObject Enumeration constant to accomplish this kind of spatial query. The code uses custom task result to first select one feature, and then do a spatial query to find the selected features which have their centroids in this feature.