[GIS] Using Select by Location and Select by Attributes in single ModelBuilder model

arcgis-10.2arcgis-desktopmodelbuilderselect-by-attributeselect-by-location

I'm working on a project involving wind turbines. I'm using ArcMap 10.2 and ModelBuilder to count the number of wind turbines within a 5km buffer zone of a given project (let's call it Project A), and then remove the turbines associated with Project A so I just have the "foreign" turbines within the buffer (e.g., those not associated with the project which establishes the median center of the buffer).

The image below shows a simple example involving just two projects, but I've got 58 different projects I need to analyze, some of which overlap with multiple wind farms which is why I am attempting to use ModelBuilder to automate the process.

The script does what I need when I step through the components individually (see figure below), but when I run the last process, it just returns an empty result.

I'm pasting the manual steps I'm trying to replicate in ModelBuilder below. I have a feeling I'm overlooking something obvious, but despite a lot of tweaking I can't figure it out.

  1. Select by Location:

    • Selection method: Select features from
    • Target layer: ALL WIND TURBINES
    • Source layer: PROJECT A (projects saved as separate layers)
    • Spatial selection method "are within a distance of the source feature" 5,000 meters
  2. Select by Attributes

    • Method: Remove from current selection
    • Where site_name = ‘PROJECT A’
    • Count using attribute table
  3. Add value of "foreign" turbines to project shapefile

    • Start Editor and add value by hand to Fr_trb field

enter image description here

enter image description here

Best Answer

You're using the selection tools incorrectly. Specifically, you're running two side by side and then adding a third when you just need two chained together. The output of your select by location should feed into your select by attributes. The current active selection is a single thing, so first you select within your buffer, then from that selection you remove the ones meeting the attribute criteria.

See Select by Attribute within a specific area (using Select by Location?) for more details/info.

Related Question