Spatial Join Features
Function Overview
The Spatial Join Features tool joins attributes from one layer to another based on spatial relationships. It compares spatial positions between features, such as containment, intersection, or proximity, to establish attribute table relationships and support cross-layer information integration and analysis.
Use Cases
| Scenario | Example | Spatial relationship |
|---|---|---|
| Point-to-polygon association | Join school points to administrative polygons to count schools in each district. | Within |
| Line-and-polygon analysis | Calculate the provinces crossed by rivers and extract river length by province. | Intersects |
| Many-to-one statistics | Count crime points within each parcel polygon. | Contains |
Parameters
Basic Settings (Required)
| Parameter | Description | Data type |
|---|---|---|
| Input vector file | Target features. Attributes from the target features and join features are included in the output features. | Point, line, polygon |
| Input vector file | Join features. Their attributes are joined to the target features. | Point, line, polygon |
| Join type | Attribute table join type. Options include: inner, which keeps only successfully matched records from both tables; left, which keeps all records from the target feature attribute table; and right, which keeps all records from the join feature attribute table. | |
| Spatial operation | Spatial relationship between target features and join features. Options include: covered_by, where target features are covered by join features and coincident boundaries are allowed; contains, where target features contain join features, including on boundaries; touches, where target features and join features touch at boundaries without overlapping; intersects, where target features and join features intersect; covers, where target features cover join features and coincident boundaries are allowed; overlaps, where target features and join features partially overlap without completely containing each other; contains_properly, where target features completely contain join features and join features must be in the interior; crosses, where the outlines of target features and join features cross; and within, where target features are within join features, including on boundaries. | |
| Output path | Storage path for the output result. | Folder path |
| Output file name | File name of the output vector file. | Text, without extension |
Advanced Settings (Optional)
| Parameter | Description |
|---|---|
| File format | Output file format. The default is GPKG VectorData (.gpv). PostGIS VectorData (.pgv), ESRI Shapefile (.shp), Keyhole Markup Language (KML) (.kml), GeoJSON (.geojson), AutoCAD DXF (.dxf), and other formats are also supported. |
| Output specified fields | When enabled, output fields can be configured manually. When disabled, the original field structure is retained. |
| Reproject | When enabled, the spatial reference of the output file can be set. Otherwise, the coordinate system of the input features is used. |
Notes
Coordinate System Consistency
- All input layers must use the same coordinate system. A projected coordinate system is recommended.
- If coordinate systems differ, use a projection tool to convert them to a common coordinate system first.
Topology Error Handling
- Check for gaps and overlaps before running the tool, for example with a topology check tool.
- Set an XY tolerance for data with topology issues. The default is 0.001 meters.
Geometry Type Compatibility
- Ensure that the target layer and join layer have compatible geometry types, such as polygon-to-polygon or point-to-polygon.
Operating Steps
Step 1: Start The Tool
Open the Geoprocessing Toolbox, go to Analysis Tools > Overlay Analysis, and double-click Spatial Join Features to open the tool pane.
Step 2: Set Parameters
-
Basic parameter configuration
In Basic Settings, enter the features for the spatial join, join type, spatial operation, output path, and output file name. All parameters are required.
-
Advanced parameter configuration
In Advanced Settings, configure optional parameters as needed, including output file format, specified output fields, and reprojection.
Step 3: Run And Monitor The Task
Click Run to start processing. You can view progress, run time, and completion status in the task list.
If the run fails, the tool provides an error message. Use the Edit button in the lower-right corner to return to the tool pane and adjust the parameters.