[GIS] How to select by location with multiple source layers

arcgis-desktopselect-by-location

I would like to script the selection of the square that contains both the orange and green points, but not the squares with any other combination of points including white points. I am very familiar with python, but I do not know if the process of selecting a target feature with two sources layers is even possible. I cannot seem to figure out the process even within ArcMap's GUI. This seems like it should be easy. Any ideas?

Pseudo code: If square contains both orange and green points but only those points > select

Select Squares

Best Answer

You can do it in the GUI, just not all at once. Multiple selections are required using a 'current selected set' that gets modified. One option would be:

  1. Select squares that intersect green.
  2. Per Michael's comment, change method to 'from current' rather than 'create new', and select squares that intersect orange. You should now have all squares containing both green and orange and none that contain only one or the other (but some may contain white as well).
  3. Again change the method, this time to 'remove from current', and do those that intersect white. You should be left with squares that only contain green and orange, and nothing else.

Related question with some help document links, which would address a case if your points were all one layer (requiring both a location and attribute selection): Select by Attribute within a specific area (using Select by Location?)