Select by Location
The "Select by Location" tool is a powerful feature for creating new selections based on the spatial relationship between features. It allows you to select features from one layer (the target layer) that have a specific geometric relationship (such as intersecting, being within, or touching) to features you have already selected on another layer (the source layer).
This tool is essential for complex spatial analysis, data validation, and answering location-based questions.
Workflow
- Create a Source Selection: Before using the tool, you must select one or more features on a vector or WMS layer. This becomes your source or "reference" selection. The selected features can have mixed geometry types (points, lines, and polygons).
- Launch the Tool: Click the
Select by Location button in the toolbar. This will open the "Select by Location" dialog window. - Configure the Analysis: In the dialog window, you will define the parameters for the analysis.
- Execute: Click the OK button to start the spatial analysis.
- View Results: After the analysis is complete, a new selection will be created on the target layer, containing all the features that met the specified spatial criteria.
Dialog Window Options
Select the target layer
This dropdown list contains all the layers available in your Workspace. You must choose the layer on which you want the new selection to be made. The features on this layer will be tested against your source selection.
Spatial Relationship
This is the core of the tool. Here you select the logical rule that defines the spatial relationship between your source features and the target features. A detailed explanation of each relationship can be found below.
Buffer
This option allows you to create a temporary buffer zone around your source features before the analysis is run. This is useful for proximity analysis (e.g., finding features "near" your selection).
- Checkbox: Use the checkbox to enable or disable the buffer functionality. If disabled, the original geometries from your source selection will be used.
- Distance and Unit Inputs:
- A positive value (e.g.,
100) expands the source geometries, creating a buffer zone around them. - A negative value (e.g.,
-10) shrinks polygon geometries (creates an inward buffer or inset). The system safely prevents a polygon from collapsing entirely by automatically restricting the shrink distance to its maximum safe limit. (Note: Negative values are ignored for points and lines). - The adjacent unit dropdown menu lets you select your preferred measurement unit (e.g., meters, kilometers, feet, degrees). The application will automatically handle all necessary geographic conversions behind the scenes to seamlessly align with your map's coordinate system.
- A positive value (e.g.,
Pro Tip: Using a 0-distance Buffer
Entering a buffer distance of0has a special and very useful side effect for polygons. While it doesn't change the size of the geometry, it forces a mathematical recalculation of the shape. This process can:This is a powerful technique for cleaning up polygon geometries "on-the-fly" for the purpose of the analysis, without altering your original data.
- Simplify complex geometries: It removes any interior rings (holes) from polygons.
- Fix topological errors: It can resolve issues like self-intersections on the source geometries.
(Note: For points and lines, a zero distance is intelligently ignored to preserve their shape and prevent analysis errors).
Spatial Relationships Explained
Here is a detailed description of each available spatial relationship. Your selection on the source layer is referred to as the "reference features".
IntersectsDescription: Selects target features that touch, cross, or overlap the reference features. This is the most general-purpose spatial relationship.
Example: Select all sewage pipes (lines) that are intersected by a planned road construction corridor (polygon).
ContainsDescription: Selects target features that completely contain your selected reference features.
Example: Select the city district (target polygon) that contains a specific, selected school (reference point).
WithinDescription: Selects target features that are completely within (surrounded by) your selected reference features.
Example: Select all fire hydrants (target points) that are located within a selected administrative zone (reference polygon).
OverlapsDescription: Selects target features that partially overlap with the reference features, but neither one completely contains the other. This applies to geometries of the same type (e.g., polygon-polygon).
Example: Select protected nature areas (target polygons) that overlap with planned development zones (reference polygons).
DisjointDescription: Selects target features that are completely separate from and do not touch or overlap the reference features in any way.
Example: Select all buildings (target polygons) that are completely outside of a designated flood zone (reference polygon).
CoversDescription: Selects target features that completely cover the reference features. This is similar to
Containsbut also includes cases where the boundaries touch.Example: Select the land parcel (target polygon) that perfectly covers a selected building footprint (reference polygon), even if they share an edge.
TouchesDescription: Selects target features that share a boundary (edge or point) with the reference features, but their interiors do not overlap.
Example: Select all neighboring land parcels (target polygons) that touch the boundary of a selected central park (reference polygon).
CrossesDescription: Selects target features that pass through the reference features. Typically used for line-line or line-polygon relationships.
Example: Select all power lines (target lines) that cross over a selected river (reference line or polygon).
Practical Example: Finding Bus Stops Near a New Bike Path
Let's find all bus stops that are within 50 meters of a newly planned bike path.
- On the "Bike paths" layer, select the feature representing the new path.
- Click the Select by Location button.
- In the dialog window:
- Set Select the target layer to "Bus Stops".
- Enable the Buffer option, enter
50in the distance input field, and select Meters from the units dropdown. - Set the Spatial Relationship to Within.
- Click OK.
The result will be a new selection on the "Bus Stops" layer, showing all stops that are conveniently located within a 50-meter corridor of the new bike path.