Select to view content in your preferred language

Setting Conditional Constraint for Select Layer By Location (Data Management) in ArcGIS Pro 2.9

607
1
12-28-2022 10:32 AM
MinK
by
New Contributor

I am trying to use Select Layer By Location (Data Management) tool with specified "WITHIN_A_DISTANCE" to select one (Input) point layer based on a (Selecting Features) polygon layer. Both layers have a common field "COUNTY" and I want to ensure that the selection is done only in the same county and not across the counties regardless of meeting the specified distance requirement. 

Currently, I know I can set the processing extent to each separate county by using additional county boundary layer and then merge those results to form statewide layer. But, I am wondering if there is a better way to accomplish this using loops in ArcPy. Is there a way to set the condition based on the same "COUNTY" attribute and select the points based on spatial relationship?

0 Kudos
1 Reply
EvelynHsu
Regular Contributor

You'll have to do select twice. The order of the following two steps does not matter, so long as the second step takes input from the output of the first step. It can be achieved with ArcPy too.

1. select layer by location, same as what you are already doing.

2. select layer by attributes, where COUNTY field value is the desired value.

0 Kudos