I am trying to replicate the join tool that is available in ArcMap by right-clicking on a layer, in an ArcPy script. Specifically, all I want is an attribute field of how many points are inside each polygon. Works perfectly inside ArcMap, but I must have it inside an ArcPy script.
My polygon file has 90 polygons, and my points file has 1,070 points. When I do the join inside ArcMap (screenshot below), my output is a polygon SHP with 90 polygons, and only a "Count_" field is added. (This is perfect.)
When I do it inside ArcPy, my output is a polygon file with 1,070 polygons, a bunch of extra fields, and no sum-count field. I've tried a few different things in the ArcPy script (i.e.,
"CONTAINS", etc.), but no luck. What am I missing?
NOTE: I don't have the Arc license that allows for "summarize_within"
arcpy.SpatialJoin_analysis(Polygons.shp, Points.shp, outFeatureClass, join_operation = "JOIN_ONE_TO_ONE", join_type = "KEEP_COMMON", field_mapping = "", match_option = "INTERSECT", search_radius = "", distance_field_name = "")