knn_weights
Generate a k-nearest neighbors spatial weights object from point data for geospatial analysis using shapefile or GeoPackage input with specified neighbor count and optional ID field.
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
Input Schema
Name | Required | Description | Default |
---|---|---|---|
data_path | Yes | ||
id_field | No | ||
k | Yes |
Input Schema (JSON Schema)
{
"properties": {
"data_path": {
"title": "Data Path",
"type": "string"
},
"id_field": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Id Field"
},
"k": {
"title": "K",
"type": "integer"
}
},
"required": [
"data_path",
"k"
],
"title": "knn_weightsArguments",
"type": "object"
}