knn_weights
Compute a k-nearest neighbors spatial weights matrix from point data. Provide the point file path and number of neighbors to generate a W object for spatial autocorrelation or econometric analysis.
Instructions
Create a k-nearest neighbors spatial weights (W) object from point data.
data_path: path to point shapefile or GeoPackage
k: number of nearest neighbors
id_field: optional attribute name to use as observation IDs
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": {
"data_path": "<data_path>",
"k": "<k>"
},
"name": "knn_weights"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data_path | Yes | ||
| k | Yes | ||
| id_field | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||