Skip to content

Generate a tree inventory from TreeMap

You are viewing in-progress documentation for v2. Switch to the stable version for the current production release.

A tree inventory is a list of individual stems — location, species, DBH, height, crown ratio, crown base height — and it’s the basis for 3D canopy fuels. FastFuels can generate one for any CONUS domain from the USGS/USFS TreeMap product in two steps:

  1. Build a PIM grid — a per-cell summary of species composition and stem density from TreeMap (pim/treemap).
  2. Realize individual trees — a point process places individual stems consistent with that grid (tree/pim).

If you also have a canopy height model (CHM) of the domain, a third, optional step places those stems only where the CHM shows canopy (tree/pim/fusion/chm) — see Condition the trees on a CHM.

  1. An API key: my-api-key.

  2. A domain within CONUS: your-domain-id. See Create a domain. TreeMap covers forested lands across the conterminous US.

POST grids/pim/treemap
curl -X 'POST' \
'https://api.fastfuels.silvxlabs.com/v2/domains/your-domain-id/grids/pim/treemap' \
-H 'accept: application/json' \
-H 'api-key: my-api-key' \
-H 'Content-Type: application/json' \
-d '{
"name": "TreeMap PIM grid"
}'

Record the id from the response as your-pim-grid-id, then poll the grid until its status is completed:

GET PIM grid status
curl -X 'GET' \
'https://api.fastfuels.silvxlabs.com/v2/domains/your-domain-id/grids/your-pim-grid-id' \
-H 'accept: application/json' \
-H 'api-key: my-api-key'

TreeMap is coarse, so the grid is small and finishes quickly. Record its id: your-pim-grid-id.

Point source_pim_grid_id at the completed PIM grid. seed fixes the stochastic point process: the same PIM grid and seed give the same trees, so you can compare a modification against an unmodified baseline.

POST inventories/tree/pim
curl -X 'POST' \
'https://api.fastfuels.silvxlabs.com/v2/domains/your-domain-id/inventories/tree/pim' \
-H 'accept: application/json' \
-H 'api-key: my-api-key' \
-H 'Content-Type: application/json' \
-d '{
"name": "TreeMap tree inventory",
"source_pim_grid_id": "your-pim-grid-id",
"seed": 42
}'

Record the inventory id: your-inventory-id. Poll until completed:

GET inventory status
curl -X 'GET' \
'https://api.fastfuels.silvxlabs.com/v2/domains/your-domain-id/inventories/your-inventory-id' \
-H 'accept: application/json' \
-H 'api-key: my-api-key'

The completed inventory’s columns describe each tree: tree_id, x, y, fia_species_code, fia_status_code, dbh (cm), height (m), crown_ratio, and crown_base_height (m). source.crown_base_height_model names the equation that computed crown_base_height.

The examples on this page run on Blue Mountain, a 1.3 by 0.9 km domain near Missoula, Montana. There this seed produces ≈44,000 stems.

Step 3 — Condition the trees on a CHM (optional)

Section titled “Step 3 — Condition the trees on a CHM (optional)”

Use this step when the tree/pim inventory leaves forest empty or puts trees on open ground. If you have a canopy height model of the domain, tree/pim/fusion/chm expands the same PIM grid but decides cell by cell, from the CHM, whether trees belong there:

  • Where the CHM shows canopy over a cell TreeMap left empty, trees from the nearest TreeMap plot are placed. This fills TreeMap’s gaps.
  • Where the CHM shows no canopy over a cell TreeMap matched, the plot is dropped and no trees are placed. This removes trees from open ground.

The trees keep TreeMap’s full attribute set — species, DBH, height, crown ratio, crown base height. The CHM decides which cells keep or receive a plot. The point process interpolates tree density between cell centres, so some stems land in neighbouring cells that hold no plot. Inventories explains why TreeMap alone misses in both directions.

Any completed grid in this domain with a chm band in meters will do. The examples below use the NAIP canopy height model, the same grid Generate a tree inventory from a CHM builds in its first step. A CHM built from a point cloud or uploaded as a GeoTIFF works the same way. Poll it to completed and record its id: your-chm-grid-id.

POST grids/canopy/naip
curl -X 'POST' \
'https://api.fastfuels.silvxlabs.com/v2/domains/your-domain-id/grids/canopy/naip' \
-H 'accept: application/json' \
-H 'api-key: my-api-key' \
-H 'Content-Type: application/json' \
-d '{
"name": "NAIP CHM grid"
}'
GET CHM grid status
curl -X 'GET' \
'https://api.fastfuels.silvxlabs.com/v2/domains/your-domain-id/grids/your-chm-grid-id' \
-H 'accept: application/json' \
-H 'api-key: my-api-key'

Point source_pim_grid_id at the PIM grid from Step 1 and source_chm_grid_id at the CHM grid. method names the fusion algorithm and its parameters. The values below are the defaults, so you can omit method to get the same result. seed works as in Step 2.

POST inventories/tree/pim/fusion/chm
curl -X 'POST' \
'https://api.fastfuels.silvxlabs.com/v2/domains/your-domain-id/inventories/tree/pim/fusion/chm' \
-H 'accept: application/json' \
-H 'api-key: my-api-key' \
-H 'Content-Type: application/json' \
-d '{
"name": "TreeMap tree inventory conditioned on CHM",
"source_pim_grid_id": "your-pim-grid-id",
"source_chm_grid_id": "your-chm-grid-id",
"seed": 42,
"method": {
"name": "reimputation",
"resolution": 7.5,
"min_height": 2.0,
"cover_threshold": 0.2
}
}'

The response’s source records both grids and their checksums, fusion: ["chm"], the method that was applied, and the crown_base_height_model, as in Step 2. Record the inventory id: your-inventory-id, and poll it to completed as in Step 2.

The columns are the same as a tree/pim inventory’s. On Blue Mountain this seed produces ≈53,300 stems against ≈44,000 from Step 2. That is more, not fewer: TreeMap has no plot for about half of this domain’s 7.5 m cells, and the CHM fills about a third of those.

Two maps of the same 1.3 by 0.9 kilometre domain side by side. Left, the canopy height model: dense canopy across the west, a canopy patch in the north-east, and open ground in the south-east. Right, each 7.5 metre cell as plot kept, gap filled, plot removed, or no trees. Kept cells form two large blocky areas, in the west and the north-east. Filled cells cover the canopy north of and between those areas that TreeMap left empty. Removed cells are scattered through the kept areas and along the western edge. Two maps of the same 1.3 by 0.9 kilometre domain side by side. Left, the canopy height model: dense canopy across the west, a canopy patch in the north-east, and open ground in the south-east. Right, each 7.5 metre cell as plot kept, gap filled, plot removed, or no trees. Kept cells form two large blocky areas, in the west and the north-east. Filled cells cover the canopy north of and between those areas that TreeMap left empty. Removed cells are scattered through the kept areas and along the western edge.

The NAIP CHM of Blue Mountain, with canopy below min_height (2 m) left blank, and the fusion decision for each 7.5 m cell at the default cover_threshold (0.2). 3,441 cells without a TreeMap plot are filled because the CHM shows canopy, and 628 cells lose their plot because it doesn’t. The decision is computed from this run’s grids with the fusion functions the API calls (fastfuels-core 0.17.1). The point process then spreads stems across neighbouring cells, so 93% of the inventory’s stems stand in cells that receive trees.

method names the fusion algorithm (reimputation, the only one) and sets three parameters. The decision is made per cell at resolution, and a cell counts as canopy-covered when more than cover_threshold of the CHM cells inside it are taller than min_height:

FieldDefaultWhat it does
resolution7.5 mCell size at which the keep-or-drop decision is made. Must be no finer than the CHM grid’s cell and no coarser than the PIM grid’s. Each grid’s cell size is the first value of its georeference.transform (about 0.6 m for NAIP and 29.5 m for TreeMap on Blue Mountain).
min_height2.0 mCHM height a cell must exceed to count as canopy. Raise it to ignore shrubs and regeneration.
cover_threshold0.2Fraction of a resolution cell that must be canopy for the cell to receive trees. Cells at or below it get none.

cover_threshold sets the balance between the two effects. A low value fills almost every TreeMap gap the CHM shows any canopy over and removes plots only from cells that are nearly bare. A high value fills only well-covered gaps and removes plots from every cell with broken canopy. On Blue Mountain, same seed:

cover_thresholdTrees
0.0556,645
0.2 (default)53,282
0.544,995
0.7537,068
tree/pim, no CHM44,099
Four maps of the same domain, one per cover_threshold of 0.05, 0.2, 0.5 and 0.75, each showing 7.5 metre cells as plot kept, gap filled, plot removed, or no trees, as in the figure above. From 0.05 to 0.75 the filled cells fall from 4,277 to 1,291 and the removed cells rise from 263 to 3,102. The filled area shrinks back toward the kept areas, and removed cells spread from their edges through their interiors. Four maps of the same domain, one per cover_threshold of 0.05, 0.2, 0.5 and 0.75, each showing 7.5 metre cells as plot kept, gap filled, plot removed, or no trees, as in the figure above. From 0.05 to 0.75 the filled cells fall from 4,277 to 1,291 and the removed cells rise from 263 to 3,102. The filled area shrinks back toward the kept areas, and removed cells spread from their edges through their interiors.

The fusion decision for each 7.5 m cell of Blue Mountain at four values of cover_threshold, computed as in the figure above. As the threshold rises, fewer TreeMap gaps are filled and more TreeMap plots are removed, starting at the edges of the forest patches and in cells with scattered cover.

Raise the threshold when TreeMap places trees on ground you know is open — recent clearings, burns, meadows the CHM resolves — and lower it when the domain has many TreeMap gaps over real forest. Check the result against the CHM by exporting both and overlaying them, as you would for a detected inventory.

Other ways to get a tree inventory: from a canopy height model (from a CHM) or by uploading your own tree list.

  • Domain outside CONUS. TreeMap is a conterminous-US product.
  • Creating the inventory before the PIM grid is completed. tree/pim reads the PIM grid’s data — poll step 1 to completed first.
  • Expecting identical trees without a seed. Omit seed and each run draws a fresh random realization. Set it when you need reproducibility.
  • Expecting a conditioned inventory to have fewer trees. Fusion fills TreeMap’s gaps as well as pruning its plots, so on a domain where TreeMap left cells unmatched it can produce more trees than tree/pim. Compare the two inventories on the map, not by count. Raise cover_threshold if you want pruning to dominate.
  • A resolution outside the grids’ cell sizes. tree/pim/fusion/chm returns 422 if method.resolution is finer than the CHM’s cell or coarser than the PIM’s. The default 7.5 m sits between the NAIP or Meta CHM and the TreeMap PIM. For a CHM coarser than 7.5 m, set resolution between the CHM’s cell size and the PIM’s.
  • A CHM grid that isn’t a 2D height surface in meters. The CHM grid must carry a chm band with unit m. A grid in feet, or a 3D grid, is rejected with 422. Uploaded GeoTIFFs are the usual cause — set the band unit when you upload.
  • No canopy above the threshold anywhere. If no cell clears cover_threshold, the inventory fails with EMPTY_AFTER_FUSION and the error message reports the highest cover observed. Lower cover_threshold or min_height, or check that the CHM covers vegetated ground.