# 3 - Generate tree cover
```{container} algorithm-id
**Algorithm ID**: `hedgetools:generatetreecover`
```
This tool generates a tree cover raster and vector layer using the DHM mask and NDVI mask obtained from [Generate DHM](./generate_dhm.md) and [Generate NDVI](./generate_ndvi.md), respectively. It intersects both masks, retaining only vegetation above the height threshold used to create the DHM mask.
The vector layer is generated from the sieved raster if a sieve operation is performed.
## Parameters
| Label | Name | Type | Description |
|-------|------|------|-------------|
| Input DHM mask | `DHM` | [raster] | Binary DHM mask raster. |
| DHM band | `DHM_BAND` | [raster band]
Default: 1 | Band of the binary DHM raster to use in case of multiband. |
| Input NDVI mask | `NDVI` | [raster] | Binary NDVI mask raster. |
| NDVI band | `NDVI_BAND` | [raster band]
Default: 1 | Band of the binary NDVI raster to use in case of multiband. |
| Extent of the study area
Optional | `EXTENT` | [extent] | Input extent from a layer, canvas, or other source to clip the rasters. |
| Compute sieved tree cover mask | `SIEVE` | [boolean]
Default: True | If enabled, the tree cover mask is sieved to remove small holes. Recommended to reduce noise in vegetation layers. |
| Threshold sieve value (pixel number) | `THRESHOLD_SIEVE` | [numeric: integer]
Default: 100 | Minimum number of pixels for a feature to be kept in the sieved mask. |
| Handling of extent differences | `EXTENT_OPT` | [enumeration]
Default: 0 | Determines how the tool handles differing DSM and DTM extents:
- 0: **Ignore** – Only check input dimensions – raise error if dimensions differ.
- 1: **Fail** – Check both CRS and dimensions – raise error if not equal.
- 2: **Union** – Execute algorithm on the union of inputs.
- 3: **Intersect** – Execute on intersection – raise error if no overlap.
|
| Output resolution (meters)
Optional | `RESOLUTION` | [numeric: double]
Default: `[same as input]` | Change the output raster resolution to the desired value. |
| Resampling method
Optional | `RESAMPLING` | [enumeration]
Optional
Default: 0 | Resampling method for output resolution: - 0: None
- 1: **Nearest Neighbour**
- 2: **Bilinear** (2x2 Kernel)
- 3: **Cubic** (4x4 Kernel)
- 4: **Cubic B-Spline** (4x4 Kernel)
- 5: **Lanczos** (6x6 Kernel)
- 6: **Average**
- 7: **Mode**
- 8: **Maximum**
- 9: **Minimum**
- 10: **Median**
- 11: **First Quartile (Q1)**
- 12: **Third Quartile (Q3)**
|
| Output tree cover raster | `OUTPUT_TREE_COVER` | [raster]
Default: `[Create temporary layer]`| Output raster. |
| Output sieve tree cover raster | `OUTPUT_SIEVE` | [raster]
Default: `[Create temporary layer]` | Output raster. |
| Output vector tree cover | `OUTPUT_VECTOR`| [vector: polygon]
Default: `[Create temporary layer]`| Polygon vector layer. |
## Outputs
| Label | Name | Type | Description |
|-------|------|------|-------------|
| Output tree cover raster | `OUTPUT_TREE_COVER` | [raster] | Tree cover raster. Intersection of the DHM and NDVI masks. |
| Output sieve tree cover raster | `OUTPUT_SIEVE` | [raster] | Tree cover raster with small holes removed based on the sieve threshold. |
| Output vector tree cover | `OUTPUT_VECTOR` | [vector: polygon] | Vectorized tree cover used in subsequent algorithms. |