This topic covers examples and expected results of the Relationship parameter options available in the Select Layer By Location tool as well as the Spatial Join tool.
For details on the Intersect 3D and Within a distance 3D options, see Select By Location: 3D relationships.
Terminology
Dialog Keyword | Python Keyword |
---|---|
Intersect | INTERSECT |
Intersect 3D | INTERSECT_3D |
Intersect (DBMS) | INTERSECT_DBMS |
Within a distance geodesic | WITHIN_A_DISTANCE_GEODESIC |
Within a distance | WITHIN_A_DISTANCE |
Within a distance 3D | WITHIN_A_DISTANCE_3D |
Contains | CONTAINS |
Completely contains | COMPLETELY_CONTAINS |
Contains Clementini | CONTAINS_CLEMENTINI |
Within | WITHIN |
Completely within | COMPLETELY_WITHIN |
Within Clementini | WITHIN_CLEMENTINI |
Are identical to | ARE_IDENTICAL_TO |
Boundary touches | BOUNDARY_TOUCHES |
Share a line segment with | SHARE_A_LINE_SEGMENT_WITH |
Crossed by the outline of | CROSSED_BY_THE_OUTLINE_OF |
Have their center in | HAVE_THEIR_CENTER_IN |
All details that follow are written using the terminology of the Select Layer By Location tool. However, these details also apply to the Spatial Join tool. The parameter names differ between the tools as follows:
- The Select Layer By Location tool has a Input Feature Layer parameter; the Spatial Join tool's equivalent parameter is Target Features.
- The Select Layer By Location tool has a Selecting Features parameter; the Spatial Join tool's equivalent parameter is Join Features.
- The Select Layer By Location tool has a Relationship parameter; the Spatial Join tool's equivalent parameter is Match Option.
Clementini spatial relationships
The Within Clementini and Contains Clementini options refer to the within and contains spatial relationships as defined in the following paper: Clementini, Eliseo, Paolino Di Felice, and Peter van Oosterom, "A Small Set of Formal Topological Relationships Suitable for End-User Interaction," Proceedings of the Third International Symposium on Advances in Spatial Databases, 277–295, June 23–25, 1993.
Contrast of the three contains spatial relationships
For lines, the boundary is the two endpoints; for polygons, the boundary is the edge.
- Contains—Selects features in the input feature layer that contain a feature in the selecting features layer. The selecting features can be inside as well as on the boundary of the input feature layer.
- Completely contains—Selects features in the input feature layer that contain a feature in the selecting features layer, as long as the feature in the selecting features layer does not intersect the boundary of the input feature layer.
- Contains Clementini—The results are identical to the Contains option with the one exception: if the feature in the selecting features layer is entirely on the boundary of the input feature layer, with no part of the contained feature properly inside the feature in the input feature layer, the input feature will not be selected. Clementini states that the boundary of a point is always empty, and the boundary of a line is the endpoints.
The Contains and Contains Clementini options produce identical results with point and multipoint input, and the selecting features are point or multipoint.
Contrast of the three within spatial relationships
- Within—Selects features in the input feature layer within or contained by features in the selecting features layer.
- Completely within—The result is identical to the Within option except when the feature in the input feature layer intersects the boundary of the feature in the selecting features layer; then it is not selected.
- Within Clementini—The result is identical to the Within option except when the entirety of the feature in the input feature layer is on the boundary of the feature in the selecting features layer. Clementini states that the boundary of a point is always empty, and the boundary of a line is the endpoints.
Legend for graphics
For all the examples below, the following legend applies:
- Input feature—Green circle
- Input feature's center—Red X
- Selecting feature—Gray square
The graphics are labeled A, B, C, and so on. Each relationship option (Intersect, Contains, and so on) that is valid for that combination of geometries is listed in the left column of the table. The geometric cases that would be selected for that relationship are listed in the right column of the table.
Select point using point
Intersect | A |
Intersect (DBMS) | A |
Contains | A |
Contains Clementini | A |
Within | A |
Within Clementini | A |
Are identical to | A |
Have their center in | A |
Select point using multipoint
Intersect | A, C |
Intersect (DBMS) | A, C |
Contains | A |
Contains Clementini | A |
Within | A, C |
Within Clementini | A, C |
Are identical to | A |
Have their center in | A, C |
Select point using line
Intersect | A, C |
Intersect (DBMS) | A, C |
Within | A, C |
Completely within | A |
Within Clementini | A |
Have their center in | A, C |
Boundary touches | C |
Select point using polygon
Intersect | A, C |
Intersect (DBMS) | A, C |
Within | A, C |
Completely within | A |
Within Clementini | A |
Have their center in | A, C |
Boundary touches | C |
Select multipoint using point
Intersect | A, C |
Intersect (DBMS) | A, C |
Contains | A, C |
Contains Clementini | A, C |
Within | A |
Within Clementini | A |
Are identical to | A |
Have their center in | A, D |
Select multipoint using multipoint
Intersect | A, C, D, E, F |
Intersect (DBMS) | A, C, D, E, F |
Contains | A, F |
Contains Clementini | A, F |
Within | A, C |
Within Clementini | A, C |
Are identical to | A |
Have their center in | A, D |
Select multipoint using line
Intersect | A, C, E, F |
Intersect (DBMS) | A, C, E, F |
Within | A, C, E |
Completely within | A |
Within Clementini | A, E |
Have their center in | A, D, E |
Boundary touches | C, E |
Select multipoint using polygon
Intersect | A, C, D, E, F |
Intersect (DBMS) | A, C, D, E, F |
Within | A, C, D, E |
Completely within | A |
Within Clementini | A, D, E |
Have their center in | A, B, C, E, F |
Boundary touches | C, E |
Select line using point
Intersect | A, C, D |
Intersect (DBMS) | A, C, D |
Contains | A, C, D |
Completely contains | A, D |
Contains Clementini | A, D |
Have their center in | D |
Boundary touches | C |
Select line using multipoint
Intersect | A, C, D, E |
Intersect (DBMS) | A, C, D, E |
Contains | A, C, E |
Completely contains | A |
Contains Clementini | A, E |
Have their center in | D |
Boundary touches | C, E |
Select line using line
Intersect | A, C, D, E, F, G, H, I, J |
Intersect (DBMS) | A, C, D, E, F, G, H, I, J |
Contains | G, H |
Completely contains | G |
Contains Clementini | G, H |
Within | F, H |
Completely within | F |
Within Clementini | F, H |
Are identical to | H |
Boundary touches | C, E |
Share a line segment with | F, G, H, I, J |
Select line using polygon
Intersect | A, C, D, E, F, G, H, I, J, K, L, M, N, O |
Intersect (DBMS) | A, C, D, E, F, G, H, I, J, K, L, M, N, O |
Within | A, D, G, H, I, O |
Completely within | A |
Within Clementini | A, D, G, H, I |
Boundary touches | F, G, H, I, K, L, M, N, O |
Share a line segment with | G, I, J, K, M, O |
Crossed by the outline of | C, E, H, L, N |
Have their center in | A, C, D, E, G, H, I, J, O |
Select polygon using point
Intersect | A, B |
Intersect (DBMS) | A, B |
Contains | A, B |
Completely contains | A |
Contains Clementini | A |
Have their center in | A, D |
Boundary touches | B |
Select polygon using multipoint
Intersect | A, B, C, E |
Intersect (DBMS) | A, B, C, E |
Contains | A, B, E |
Completely contains | A |
Contains Clementini | A, B |
Have their center in | A, D |
Boundary touches | E |
Select polygon using line
Intersect | A, C, D, E, F, G, H, I, J, K, L, M, N, O |
Intersect (DBMS) | A, C, D, E, F, G, H, I, J, K, L, M, N, O |
Contains | A, D, G, H, I, O |
Completely contains | A |
Contains Clementini | A, D, G, H, I |
Boundary touches | F, G, H, I, K, L, M, N, O |
Share a line segment with | G, I, J, K, M, O |
Crossed by the outline of | C, E, H, L, N |
Have their center in | E, I, L |
Select polygon using polygon
Intersect | A, C, D, E, F, G, H, I, J, K, M |
Intersect (DBMS) | A, C, D, E, F, G, H, I, J, K, M |
Contains | C, E, H, M |
Completely contains | C |
Contains Clementini | C, E, H, M |
Within | F, G, H, M |
Completely within | F |
Within Clementini | F, G, H, M |
Are identical to | H, M |
Boundary touches | D, E, G, H, I, J, M |
Share a line segment with | D, H, I, M |
Crossed by the outline of | A, E, G, J, K |
Have their center in | C, E, F, G, H, K, L |