Spatial Join
spatial_joinJoin attributes from one layer to another by spatial relationship using predicates such as intersects, contains, or within. Select match method and copied fields to enrich target features.
Instructions
Join attributes by location (native:joinattributesbylocation). predicates int list: 0=intersects 1=contains 2=equals 3=touches 4=overlaps 5=within 6=crosses (default [0]). method: 0=one-to-many 1=first match (default) 2=largest overlap. First match keeps one arbitrary match per target feature and drops the others; use 0 when several can match. join_fields = copied columns (default all). No output_path = in-memory layer. Returns joined_count (target features that found a match, whatever the method) next to target_features. warnings/warning_count report features QGIS skipped, e.g. invalid geometries under the Processing setting that skips them; fix them first (native:fixgeometries) or those features never match.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"target_layer": "<target_layer>",
"join_layer": "<join_layer>"
},
"name": "spatial_join"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| method | No | ||
| prefix | No | ||
| join_layer | Yes | ||
| predicates | No | ||
| join_fields | No | ||
| output_path | No | ||
| target_layer | Yes |