# Network distance to forest ```{container} algorithm-id **Algorithm ID**: `hedgetools:networkdistancetoforest` ``` This tool calculates the distance between a hedge sub-network and the nearest forest (input layer). The tool first reconstructs the sub-networks. A sub-network is a cluster of connected arcs, so multiple arcs can belong to the same sub-network if they are connected. Next, the distance is computed between each node of the hedges within the sub-networks and the forests. The distance results are recorded at the level of each node (as a new attribute), including the unique identifier of the nearest forest. In the arcs layer, a unique identifier of the sub-network to which each arc belongs is also recorded. The forest layer can be any polygon vector layer. ## Parameters | Label | Name | Type | Description | |-------|------|------|-------------| | Input polygon layer | `INPUT_POLYGON` | [vector: polygon] | Polygon vector layer representing the hedges. Used to create connection points to forests, as hedge arcs may not necessarily intersect the forest polygons. | | Input arc layer | `INPUT_ARC` | [vector: line] | Line vector layer representing the hedge median axis. | | Input node layer | `INPUT_NODE` | [vector: point] | Point vector layer of hedge extremities. | | Input forest layer | `INPUT_FOREST` | [vector: polygon] | Polygon vector layer representing forests. | | Forest id field | `ID_FIELD` | [field: any] | Field containing the unique identifier of each forest polygon. | | Spatial threshold (meters) | `THRESHOLD` | [numeric: double] | Distance threshold used to consider hedges without a physical connection as connected. | | Override network construction from attributes | `OVERRIDE` | [boolean]
Default: True | If toggled, will not use the `network_id` and `n_threshold` fields to build the network but the specified `Spatial threshold` value. | | Output network distance layer | `OUTPUT_ARC` | [vector: line]
Default: `[Create temporary layer]` | Output line vector layer. | | Output network node layer | `OUTPUT_NODE` | [vector: point]
Default: `[Create temporary layer]` | Output point vector layer. | ## Outputs | Label | Name | Type | Description | |-------|------|------|-------------| | Output network distance layer | `OUTPUT_ARC` | [vector: line] | Line vector layer with two new fields describing the nerworks : | | Output network node layer | `OUTPUT_NODE` | [vector: point] | Point vector layer with two new fields: `n_forest_id` (ID of closest forest) and `n_forest_dist` (distance to closest forest along the network). |