Select Layer By Location (Data Management Tools)
Summary
Selects features based on a spatial relationship to features in another dataset or the same dataset.
Each feature in the Input Features parameter is evaluated using the features in the Selecting Features parameter. If the specified Relationship parameter value is met, the input feature is selected.
Learn more about Select By Location including image examples of relationships
Usage
If the input is a feature class or dataset path, this tool will create and return a new layer with the result of the tool applied.
The coordinate system in which the spatial relationship is evaluated can affect the result. Features that intersect in one coordinate system may not intersect in another.
- This tool evaluates a spatial relationship in the coordinate system of the Input Features parameter value. Set the Output Coordinate System environment to Current Map [Map] to use the same coordinate system as the current display.
To select features based on their spatial relationships to other features in the same layer, see the examples in Select based on spatial relationship within the layer.
The number of selected records will be listed in the geoprocessing history. Click Parameters > Count to access them. Additionally, the Get Count tool can be used to count the number of selected records. From Python, the number of selected records can also be accessed from the tool's
Resultobject.When using this tool, it is a possible and a valid result for none of the features to meet the criteria for selection. If this occurs, a selection will be applied to the layer with zero features selected. Geoprocessing tools that use this layer as input will get no features when they are run. For example, the Get Count tool will return a result of 0. To remove this, or any other, selection use the Select Layer By Attribute tool's Selection Type parameter's Clear the current selection option.
If the input layer has a definition query, only the features matching the definition query will be used in the operation and be candidates for selection.
For more information about using the 3D spatial relationship options Intersect 3D and Within a distance 3D, see Select By Location: 3D relationships.
For the Relationship parameter, the Intersect (DBMS) option may provide better performance than the Intersect option when using enterprise geodatabase data; however, this option is only supported under specific conditions. If all conditions are met, the spatial operation will be performed in the enterprise geodatabase database management system (DBMS) rather than on the client. Consider the following when using this spatial relationship option:
The following requirements are necessary for the operation to run in the DBMS:
The Input Features and Selecting Features parameter values must be from the same enterprise geodatabase workspace and have the same spatial reference and geometry storage type.
The user connecting to the geodatabase must have privileges to create a view in the database where the feature classes are stored.
Supported geometry storage types for this option are ST_Geometry (IBM Db2, Oracle, PostgreSQL, and SAP HANA), PostGIS (PostgreSQL), SDO_GEOMETRY (Oracle), and Geometry and Geography (Microsoft SQL Server). See Geodatabase management for information about installing and configuring your DBMS as well as information about configuring the geometry storage type of your choice so it will be available for use. See the vendor documentation specific to your DBMS to determine what to expect for each geometry storage type. There may be storage limitations that will impact performance and scalability when running spatial operations.
If the feature classes in Oracle use ST_Geometry to store spatial data, you must configure the Oracle extproc to access ST_Geometry. See Configure the extproc to access ST_Geometry in Oracle for more information.
The Search Distance parameter is not set.
The Selection Type parameter value is New selection.
Existing selections that were made before running the tool were made using a layer definition query, not a selection set.
The spatial operation is performed without applying an x,y tolerance during processing. Using an x,y tolerance is not supported in the DBMS. This may result in slightly different selections being returned compared to when the analysis is performed on the client with an x,y tolerance applied. See Feature class basics for more information about how an x,y tolerance is applied during client-side operations.
Parameters
| Label | Explanation | Data type |
|---|---|---|
|
Input Features |
The features that will be evaluated using the Selecting Features parameter values. The selection will be applied to these features. |
Feature Layer; Mosaic Layer |
|
Relationship (Optional) |
Specifies the spatial relationship that will be evaluated.
|
String |
|
Selecting Features (Optional) |
The features in the Input Features parameter will be selected based on their relationship to the features from this layer or feature class. |
Feature Layer |
|
Search Distance (Optional) |
The distance that will be searched. This parameter is only valid if the Relationship parameter is set to Intersect, Intersect 3D, Within a distance, Within a distance 3D, Within a distance geodesic, Contains, or Have their center in. If the Within a distance geodesic option is specified, use a linear unit such as kilometers or miles. |
Linear Unit |
|
Selection Type (Optional) |
Specifies how the selection will be applied to the input and how it will be combined with an existing selection. This tool does not include an option to clear an existing selection; use the Select Layer By Attribute tool with the Selection Type parameter set to Clear the current selection to do that.
|
String |
|
Invert Spatial Relationship (Optional) |
Specifies whether the spatial relationship evaluation result or the opposite result will be used. For example, this parameter can be used to get a list of features that do not intersect or are not within a given distance of features in another dataset.
|
Boolean |
Derived output
| Label | Explanation | Data type |
|---|---|---|
|
Layer With Selection |
The first input with the selection applied. |
Feature Layer; Mosaic Layer |
|
Output Layer Names |
A multivalue parameter including all inputs with selections applied. Use this output parameter in a model to connect to a tool with a multivalue input such as the Merge tool. |
Feature Layer; Mosaic Layer |
|
Count |
The number of selected records. If there are multiple Input Features parameter values, the counts will be in the same order as the inputs. |
Long |
Environments
Current Workspace, Output Coordinate System, Extent
Licensing information
- Basic: Yes
- Standard: Yes
- Advanced: Yes