# Selecting points intersecting polygon

In ArcGIS 10.2 ArcMap am attempting to label a grid of varying size polygons overlaid by a grid of evenly spaced (1km) points with an associated value X by the the value of the point. If a polygon is intersected by more than 1 then I want it to be labelled with the maximum X value. If a polygon doesn't intersect with a point I want it to be labelled with the nearest point.

I used spatial join with one to one intersect and maximum value for X to be selected. This allowed me to get the maximum value for multiple points that intersected. However it doesn't allow me to label the polygons where a point does not intersect it. I put a search radius on it and then it can label polygons with points where X is greater but are not contained in the actual polygon.

• You already solved the first part of the problem with the Spatial Join. Why not add a field to the original, join the Spatial Join output to it and calculate the max X into the field for the polygons that got a hit. Then select all polygons that have Null in that field and run the NEAR tool. Join the nearest points on its FID and the new NEAR_FID field and calculate the X values over from that point to your original polygons. Near with search tolerance is what you want, not Spatial Join with a search tolerance. You can drop the NEAR_FID and NEAR_DIST fields if you want after the calc. Jun 8, 2015 at 0:49
• Thanks, I had considered something like that, just wondering if possible to do in one check as I need to consider the automation side. Jun 8, 2015 at 21:07
• It is not possible. Geoprocessing is meant to be done by piling many tools that do a limited number of things on top of each other, not by designing or using supertools that do many things. Even with python geometry methods and a cursor (which would be slower), you have to split the problem into at least 2 completely separate steps. Near and Spatial Join can't be done in a single step (unless you just wanted one of the points that fell inside or near the polygon without counting all of the points inside). Jun 8, 2015 at 23:47
• @RichardFairhurst I think a copy/paste of your comments would qualify as an answer that I would vote for.
– PolyGeo
Aug 23, 2016 at 21:39