From lidar to a tree inventory
You are viewing in-progress documentation for v2. Switch to the stable version for the current production release.
The USGS 3D Elevation Program publishes airborne lidar flown over the Blackfoot River valley in Montana in 2021. In this tutorial we will turn its returns into a tree inventory: one row per tree, each with a position, a height, a diameter, a crown base height, and a species.
We will work on about half a square kilometre of river valley, building it in six calls and then inspecting what we made:
| Step | What we do |
|---|---|
| 1 | Create a domain — the patch of ground everything else hangs off |
| 2 | Run a coverage check — is there lidar here, and whose? |
| 3 | Fetch a point cloud — 10.5 million returns, clipped to the domain |
| 4 | Build a canopy height model — the returns rasterized to a 1 m height surface |
| 5 | Detect trees — a detected inventory, one tree per treetop |
| 6 | Fill in the rest — a fully attributed inventory with diameter, crown base height, and species |
| 7 | Inspect the result |
Every step after the first two is asynchronous: one POST starts it, and you
GET the resource until its status reaches completed. So the rhythm of the
whole tutorial is create → poll → use the id in the next call. In the
Python SDK the poll is resource.wait(), and the Python tabs form one
continuous script. You import and authenticate once in Step 1, then each step
keeps the object it just made and passes it to the next.
Prerequisites
Section titled “Prerequisites”-
An API key. Create one in the FastFuels web app under your account settings. Set it once here and it propagates to every code block on the page: my-api-key. The SDK reads it via
ff.set_api_key(...)or theFASTFUELS_API_KEYenvironment variable. -
curl, or Python with the FastFuels SDK —pip install fastfuels-sdk(v0.23.1+ for v2).
That’s all — we create everything else as we go.
Step 1 — Create a domain
Section titled “Step 1 — Create a domain”A domain is the georeferenced extent every other resource belongs to. We
POST a GeoJSON FeatureCollection to /domains.
We give the coordinates in UTM zone 12N (EPSG:32612) rather than longitude and
latitude. Every resource we build from the domain keeps that CRS.
curl -X 'POST' \ 'https://api.fastfuels.silvxlabs.com/v2/domains' \ -H 'accept: application/json' \ -H 'api-key: my-api-key' \ -H 'Content-Type: application/json' \ -d '{ "type": "FeatureCollection", "name": "Blackfoot River", "description": "About half a square kilometre of the Blackfoot River valley, Montana.", "crs": { "type": "name", "properties": { "name": "EPSG:32612" } }, "features": [ { "type": "Feature", "properties": {}, "geometry": { "type": "Polygon", "coordinates": [[ [294095.0, 5198982.0], [294785.0, 5198982.0], [294785.0, 5199750.0], [294095.0, 5199750.0], [294095.0, 5198982.0] ]] } } ]}'import fastfuels_sdk.v2 as ff
ff.set_api_key("my-api-key")
domain = ff.Domain.from_geojson( { "type": "FeatureCollection", "crs": {"type": "name", "properties": {"name": "EPSG:32612"}}, "features": [ { "type": "Feature", "properties": {}, "geometry": { "type": "Polygon", "coordinates": [ [ [294095.0, 5198982.0], [294785.0, 5198982.0], [294785.0, 5199750.0], [294095.0, 5199750.0], [294095.0, 5198982.0], ] ], }, } ], }, name="Blackfoot River", description="About half a square kilometre of the Blackfoot River valley, Montana.",){ "bbox": [294095.0, 5198982.0, 294785.0, 5199750.0], "type": "FeatureCollection", "features": [ { "type": "Feature", "geometry": { "type": "Polygon", "coordinates": [ [ [294095.0, 5198982.0], [294785.0, 5198982.0], [294785.0, 5199750.0], [294095.0, 5199750.0], [294095.0, 5198982.0] ] ] }, "properties": { "name": "domain" } } ], "name": "Blackfoot River", "description": "About half a square kilometre of the Blackfoot River valley, Montana.", "crs": { "type": "name", "properties": { "name": "EPSG:32612" } }, "id": "your-domain-id", "created_on": "2026-11-03T20:56:27.585045", "modified_on": "2026-11-03T20:56:27.585045"}This one returns immediately, with no job to wait for. Record the id, since every call below hangs off it: your-domain-id.
Notice the bbox in the response: 294095, 5198982 to 294785, 5199750. That
is 690 m east–west by 768 m north–south, and those numbers reappear in every
resource we build from here.
Step 2 — Ask what lidar is there
Section titled “Step 2 — Ask what lidar is there”Before fetching anything, we ask what the USGS 3D Elevation Program holds over this domain. The answer comes back immediately and tells us whether the fetch will succeed and what it will contain.
curl -X 'GET' \ 'https://api.fastfuels.silvxlabs.com/v2/domains/your-domain-id/pointclouds/3dep/coverage' \ -H 'accept: application/json' \ -H 'api-key: my-api-key'coverage = ff.point_clouds.check_3dep_coverage(domain){ "available": true, "coverage_fraction": 1.0, "datasets": [ { "name": "MT_Statewide_P3_4_B21", "url": "https://s3-us-west-2.amazonaws.com/usgs-lidar-public/MT_Statewide_P3_4_B21/ept.json", "contribution_fraction": 1.0, "estimated_density": 14.811981421134373, "estimated_points": 7847291 } ], "estimated_point_count": 7847291}One acquisition, MT_Statewide_P3_4_B21, covers the whole domain on its own:
its contribution_fraction is 1.0.
Note the acquisition’s name. We are going to pin it in the next call.
Step 3 — Fetch the point cloud
Section titled “Step 3 — Fetch the point cloud”Now we pull the returns. Passing datasets pins the fetch to the acquisition we
just found, so this tutorial produces the same cloud today and next year even if
USGS publishes new lidar over the valley.
curl -X 'POST' \ 'https://api.fastfuels.silvxlabs.com/v2/domains/your-domain-id/pointclouds/3dep' \ -H 'accept: application/json' \ -H 'api-key: my-api-key' \ -H 'Content-Type: application/json' \ -d '{ "name": "Blackfoot ALS (pinned)", "description": "Pinned to a single 3DEP acquisition so the fetch is reproducible.", "tags": ["blackfoot", "3dep"], "datasets": ["MT_Statewide_P3_4_B21"]}'point_cloud = ff.point_clouds.create_point_cloud_from_3dep( domain, datasets=["MT_Statewide_P3_4_B21"], # optional — pins the acquisition so re-runs are reproducible name="Blackfoot ALS (pinned)", description="Pinned to a single 3DEP acquisition so the fetch is reproducible.", tags=["blackfoot", "3dep"],)Record the id, your-point-cloud-id, and poll until status is
completed.
curl -X 'GET' \ 'https://api.fastfuels.silvxlabs.com/v2/domains/your-domain-id/pointclouds/your-point-cloud-id' \ -H 'accept: application/json' \ -H 'api-key: my-api-key'point_cloud.wait(){ "id": "your-point-cloud-id", "domain_id": "your-domain-id", "type": "als", "name": "Blackfoot ALS (pinned)", "description": "Pinned to a single 3DEP acquisition so the fetch is reproducible.", "status": "completed", "progress": { "percent": 100, "message": "Complete" }, "created_on": "2026-11-03T20:56:29.227009Z", "modified_on": "2026-11-03T20:56:55.055127Z", "checksum": "58edea2547934fcfa6d099bbbc827d4e", "source": { "datasets": ["MT_Statewide_P3_4_B21"], "name": "3dep", "requested_datasets": ["MT_Statewide_P3_4_B21"], "catalog_fetched_on": "2026-11-03T20:56:44.339752+00:00", "coverage_fraction": 1.0 }, "georeference": { "crs": "EPSG:32612", "bounds": [ 294095.0, 5198982.0, 1026.3600000000001, 294785.0, 5199750.0, 1274.19 ] }, "summary": { "point_count": 10512255, "point_classes": [1, 2, 7, 9, 18, 20], "density": 19.837437726449274 }, "error": null, "tags": ["blackfoot", "3dep"]}10,512,255 returns at 19.8 per square metre. Notice two things in that response.
First, the coverage check in Step 2 estimated 7,847,291 points, and we received 10.5 million, about a third more. The estimate comes from the acquisition’s published average density. See estimate versus delivered for the detail.
Second, point_classes lists 1, 2, 7, 9, 18, 20. Class 2 is ground and class 1
is unclassified, mostly vegetation here. Those two are what the next step needs:
without ground returns, there is no surface to measure height above.
The returns themselves, coloured by height above ground:
A 120 m block of the domain, holding 359,013 returns. The inset shows where the block sits. Brown points are near the ground, green points are canopy. Every second return is drawn. The full cloud covers the whole domain and holds 10,512,255 returns.
Step 4 — Build the canopy height model
Section titled “Step 4 — Build the canopy height model”A canopy height model is a raster where each cell holds the height of the tallest return above the ground beneath it. This is the step that turns a cloud of points into a surface we can look for trees in.
curl -X 'POST' \ 'https://api.fastfuels.silvxlabs.com/v2/domains/your-domain-id/grids/canopy/point_cloud' \ -H 'accept: application/json' \ -H 'api-key: my-api-key' \ -H 'Content-Type: application/json' \ -d '{ "source_point_cloud_id": "your-point-cloud-id", "name": "Canopy height from 3DEP lidar", "description": "CHM rasterized from the pinned Blackfoot point cloud.", "tags": ["blackfoot", "chm"]}'grid = ff.grids.create_canopy_height_grid_from_point_cloud( point_cloud, name="Canopy height from 3DEP lidar", description="CHM rasterized from the pinned Blackfoot point cloud.", tags=["blackfoot", "chm"],)Record the grid id, your-chm-grid-id, and poll it to completed.
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'grid.wait(){ "id": "your-chm-grid-id", "domain_id": "your-domain-id", "name": "Canopy height from 3DEP lidar", "description": "CHM rasterized from the pinned Blackfoot point cloud.", "status": "completed", "progress": { "percent": 100, "message": "Complete" }, "created_on": "2026-11-03T20:56:55.547708Z", "modified_on": "2026-11-03T20:57:28.977174Z", "checksum": "ee0d2959d3a54e0fb3f5374e25fa46b8", "source": { "alignment": { "target": "domain", "resolution": 1.0 }, "name": "canopy", "extent_buffer_cells": 0, "product": "point_cloud", "description": "Canopy height model rasterized from a point cloud", "ground": { "max_ground_distance_m": 35.2, "ground_coverage": 0.9053, "ground_source": "classification" }, "source_point_cloud_checksum": "58edea2547934fcfa6d099bbbc827d4e", "source_point_cloud_id": "your-point-cloud-id", "aggregation": { "method": "max" }, "spike_filter": { "min_canopy_footprint_m": 3.0, "min_prominence_m": 25.0 } }, "modifications": [], "bands": [ { "key": "chm", "name": "Canopy Height", "description": "Height above ground of the canopy top.", "type": "continuous", "unit": "m", "index": 0, "nodata": null, "summary": { "type": "continuous", "count": 495428, "nodata_count": 34492, "min": 0.0, "max": 37.64274215698242, "mean": 4.683827075584505, "std": 6.62168395136597 } } ], "georeference": { "crs": "EPSG:32612", "transform": [1.0, 0.0, 294095.0, 0.0, -1.0, 5199750.0], "shape": [768, 690] }, "error": null, "chunks": { "shape": [512, 512], "count": 4, "count_by_axis": { "x": 2, "y": 2 } }, "tags": ["blackfoot", "chm"]}We asked for no resolution, so the grid defaulted to 1 m: a shape of
[768, 690], one cell per metre of the domain.
Now look at source.ground, which records how the ground under the canopy was
found. ground_source is classification: the ground came from the class 2
returns. ground_coverage is 0.9053: 90.5% of cells had ground returns close
enough to use directly, and the rest were interpolated.
Read source.ground
explains each field.
The chm band summary has a count of 495,428 and a nodata_count of 34,492,
so 6.5% of the domain has no height at all. Those cells are the river. The CHM
leaves out returns classified as water (class 9). The tallest cell is 37.64 m.
The finished CHM, 10.5 million returns rasterized to 1 m. Every dot is a crown. The grey ribbon is the Blackfoot River, the 6.5% of cells with no height.
Step 5 — Detect the trees
Section titled “Step 5 — Detect the trees”Now we look for treetops. A treetop is a local maximum in the height surface:
a cell taller than everything around it. The lmf algorithm slides a window over
the CHM and places one tree at each peak it finds.
Two parameters shape the result. footprint_size: 5 is the diameter of the
circular window, in pixels. On our 1 m grid that is a circle 5 m across.
min_height: 2 ignores anything under 2 m, so we detect trees rather than
shrubs.
curl -X 'POST' \ 'https://api.fastfuels.silvxlabs.com/v2/domains/your-domain-id/inventories/tree/chm' \ -H 'accept: application/json' \ -H 'api-key: my-api-key' \ -H 'Content-Type: application/json' \ -d '{ "name": "Detected treetops", "source_chm_grid_id": "your-chm-grid-id", "algorithm": { "name": "lmf", "min_height": 2, "footprint_size": 5 }}'from fastfuels_sdk.v2.client_library.models import StemIsolationLmf
detected = ff.inventories.create_tree_inventory_from_chm_grid( domain, grid, algorithm=StemIsolationLmf(min_height=2, footprint_size=5), name="Detected treetops",)Record this inventory’s id, inventory-to-complete, and poll it to
completed.
curl -X 'GET' \ 'https://api.fastfuels.silvxlabs.com/v2/domains/your-domain-id/inventories/inventory-to-complete' \ -H 'accept: application/json' \ -H 'api-key: my-api-key'detected.wait(){ "id": "inventory-to-complete", "domain_id": "your-domain-id", "type": "tree", "name": "Detected treetops", "description": "", "status": "completed", "progress": { "percent": 100, "message": "Complete" }, "created_on": "2026-11-03T20:57:32.098652Z", "modified_on": "2026-11-03T20:58:03.281243Z", "checksum": "6970d5ee33834e04b5a55f17f5310774", "source": { "algorithm": { "name": "lmf", "footprint_size": 5, "max_height": 120.0, "min_height": 2.0 }, "crown_segmentation": null, "name": "chm", "source_chm_grid_checksum": "ee0d2959d3a54e0fb3f5374e25fa46b8", "source_chm_grid_id": "your-chm-grid-id" }, "modifications": [], "treatments": [], "columns": [ { "key": "tree_id", "type": "categorical", "unit": null, "summary": { "type": "categorical", "count": 5704, "null_count": 0, "unique_count": 5704 } }, { "key": "x", "type": "continuous", "unit": "m", "summary": { "type": "continuous", "count": 5704, "null_count": 0, "min": 294095.5, "max": 294784.5, "mean": 294432.3616760168, "std": 198.54900263196438 } }, { "key": "y", "type": "continuous", "unit": "m", "summary": { "type": "continuous", "count": 5704, "null_count": 0, "min": 5198982.5, "max": 5199749.5, "mean": 5199325.219845722, "std": 240.39575993484803 } }, { "key": "height", "type": "continuous", "unit": "m", "summary": { "type": "continuous", "count": 5704, "null_count": 0, "min": 2.00134539604187, "max": 37.64274215698242, "mean": 13.151576479011297, "std": 6.974374958995433 } } ], "forestry_metrics": null, "georeference": { "crs": "EPSG:32612", "bounds": [294095.0, 5198982.0, 294785.0, 5199750.0] }, "error": null, "tags": []}5,704 trees. We have gone from a cloud of points to a list of individual stems. Heights run from the 2 m floor we set to 37.64 m, averaging 13.2 m.
Notice that the tallest tree is exactly as tall as the tallest CHM cell, 37.642742 m in both. A detected treetop is a cell of the height surface, so detection can never return a height the CHM did not already hold.
Now notice what is missing. The columns are tree_id, x, y, and height,
and forestry_metrics is null. A height surface seen from above cannot tell
us how thick a trunk is, how far down the crown reaches, or what species we are
looking at. Without a diameter there is no basal area, and without basal area
there are no stand metrics. Step 6 fills in those columns.
Detected treetops over a 200 m window of dense forest on the south bank, 523 of the 5,704 trees. Each dot is one row of the inventory, placed at a local maximum of the height surface.
Step 6 — Fill in what the CHM could not see
Section titled “Step 6 — Fill in what the CHM could not see”GDAM (Generalized Dendro Allometric Model) takes each tree’s position and height and imputes the attributes lidar could not observe. We point it at the inventory we just made.
curl -X 'POST' \ 'https://api.fastfuels.silvxlabs.com/v2/domains/your-domain-id/inventories/tree/allometry/gdam' \ -H 'accept: application/json' \ -H 'api-key: my-api-key' \ -H 'Content-Type: application/json' \ -d '{ "name": "Fully attributed tree inventory", "source_tree_inventory_id": "inventory-to-complete"}'inventory = ff.inventories.create_tree_inventory_with_gdam_allometry( domain, detected, name="Fully attributed tree inventory",)This creates a new inventory rather than modifying the detected one. Record
its id as your-inventory-id and poll it to completed.
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'inventory.wait(){ "id": "your-inventory-id", "domain_id": "your-domain-id", "type": "tree", "name": "Fully attributed tree inventory", "description": "", "status": "completed", "progress": { "percent": 100, "message": "Complete" }, "created_on": "2026-11-03T20:58:03.488883Z", "modified_on": "2026-11-03T20:58:32.319504Z", "checksum": "c04a7b6e32ca4ce6949e862d1fc85667", "source": { "overwrite": false, "conditioned_columns": [], "name": "gdam", "source_tree_inventory_checksum": "6970d5ee33834e04b5a55f17f5310774", "crown_base_height_model": { "name": "gdam" }, "impute_columns": [ "dbh", "crown_ratio", "fia_species_code", "crown_base_height" ], "source_tree_inventory_id": "inventory-to-complete" }, "modifications": [], "treatments": [], "columns": [ { "key": "tree_id", "type": "categorical", "unit": null, "summary": { "type": "categorical", "count": 5704, "null_count": 0, "unique_count": 5704 } }, { "key": "x", "type": "continuous", "unit": "m", "summary": { "type": "continuous", "count": 5704, "null_count": 0, "min": 294095.5, "max": 294784.5, "mean": 294432.3616760168, "std": 198.5490026319628 } }, { "key": "y", "type": "continuous", "unit": "m", "summary": { "type": "continuous", "count": 5704, "null_count": 0, "min": 5198982.5, "max": 5199749.5, "mean": 5199325.219845722, "std": 240.39575993475967 } }, { "key": "height", "type": "continuous", "unit": "m", "summary": { "type": "continuous", "count": 5704, "null_count": 0, "min": 2.00134539604187, "max": 37.64274215698242, "mean": 13.151576479011297, "std": 6.9743749589954325 } }, { "key": "dbh", "type": "continuous", "unit": "cm", "summary": { "type": "continuous", "count": 5704, "null_count": 0, "min": 2.236796522458139, "max": 105.74071224164973, "mean": 24.823309314966323, "std": 14.713270524592598 } }, { "key": "crown_ratio", "type": "continuous", "unit": null, "summary": { "type": "continuous", "count": 5704, "null_count": 0, "min": 0.024274571724946487, "max": 0.9922496193389896, "mean": 0.6089459051683425, "std": 0.20060535069067115 } }, { "key": "fia_species_code", "type": "categorical", "unit": null, "summary": { "type": "categorical", "count": 5704, "null_count": 0, "unique_count": 8 } }, { "key": "crown_base_height", "type": "continuous", "unit": "m", "summary": { "type": "continuous", "count": 5704, "null_count": 0, "min": 0.006196251787131315, "max": 28.673380665292534, "mean": 3.730796498156423, "std": 3.8439705719476245 } } ], "forestry_metrics": { "type": "tree", "tree_count": 5704, "basal_area_per_area": 30.66235286716636, "tree_density": 43.56008712017423, "quadratic_mean_diameter": 11.360427492256088, "dominant_species_groups": [ { "spgrpcd": 4, "name": "Pine", "basal_area_share": 0.7355787323892364 }, { "spgrpcd": 2, "name": "Douglas-fir", "basal_area_share": 0.253166307745671 }, { "spgrpcd": 1, "name": "Cedar/larch", "basal_area_share": 0.005544800612670505 }, { "spgrpcd": 10, "name": "Juniper/oak/mesquite", "basal_area_share": 0.005401712096264964 }, { "spgrpcd": 3, "name": "True fir/hemlock", "basal_area_share": 0.00021598751486221526 } ] }, "georeference": { "crs": "EPSG:32612", "bounds": [294095.0, 5198982.0, 294785.0, 5199750.0] }, "error": null, "tags": []}Same 5,704 trees, in the same places, at the same heights. The new columns are
dbh (diameter at breast height, in cm), fia_species_code, and
crown_base_height (the height of the lowest live branches, in m). GDAM also
returns crown_ratio, the fraction of each tree’s height that is crown.
And forestry_metrics is no longer null. Its numbers follow FIA convention
rather than the metric columns above: basal area in ft²/acre, tree density in
trees per acre, and quadratic mean diameter in inches. Our stand comes out at
about 44 trees per acre, a basal area of about 31 ft²/acre, and a
quadratic mean diameter of about 11.4 in, with pines holding about 74%
of the basal area and Douglas-fir about 25%. The imputed values are random
draws (see Species), so your run will land close to these numbers
rather than on them.
Nothing about the stand changed between Step 5 and Step 6. The diameters now exist, and every metric that depends on them followed.
Three columns across all 5,704 trees. Height is measured, and its long tail is the spread of the stand. The other two are imputed. Each tree’s value is a draw from GDAM’s model for its position and height, so their spread is the model’s, not a measurement of this stand.
Step 7 — Inspect the trees
Section titled “Step 7 — Inspect the trees”Every column we just added came out of a model. Before building anything on this inventory, we look at it.
The map below draws all 5,704 trees. Click any one to see its stored values, and zoom in where the canopy is dense:
Fetch the same values for the whole inventory with the data endpoints, as Parquet, CSV, or GeoJSON.
What to look for
Section titled “What to look for”- Detections on things that are not trees. Detection runs on a surface model, which records what is physically there rather than what is vegetation. This domain has an example, in The power line below.
- The tree count. Our 5,704 detections over 0.53 km² are 44 trees per acre.
footprint_sizeandmin_heightfrom Step 5 set that count. - Attribute ranges. Across the inventory the imputed columns span
2.2–105.7 cm
dbhand 0.01–28.7 mcrown_base_height, with a mediandbhof 23 cm and a mediancrown_base_heightof 2.5 m. - Species composition. See Species below.
The power line
Section titled “The power line”A transmission line crosses the north-east of this domain, and detection has placed a chain of trees along it:
The conductors appear in the CHM as thin parallel lines, and 95 of the 5,704 detections, 1.7% of the inventory, sit on them.
The vendor left the wires in ASPRS class 1 with the vegetation, so they appear in the CHM as canopy. Nothing in the pipeline flags these 95 detections. They stay in the inventory until you remove them, as Next steps describes.
Species
Section titled “Species”GDAM assigned 8 species. Ponderosa pine and Douglas-fir make up 97.6% of the trees:
| Species | FIA code | Trees |
|---|---|---|
| ponderosa pine | 122 | 3,976 |
| Douglas-fir | 202 | 1,592 |
| Rocky Mountain juniper | 66 | 97 |
| western larch | 73 | 28 |
| grand fir | 17 | 4 |
| lodgepole pine | 108 | 3 |
| quaking aspen | 746 | 2 |
| limber pine | 113 | 2 |
GDAM does not pick the likeliest species for a tree. It draws one at random from its model’s distribution for that position and height. The draws are seeded from the inventory’s id, so a new run of this tutorial, which creates a new inventory, gives slightly different counts. Species are model draws, not observations.
The whole pipeline in one script
Section titled “The whole pipeline in one script”Every call above, in order, with the polling folded in:
"""Blackfoot River: 3DEP lidar to a fully attributed tree inventory.
Runs the whole tutorial end to end with the FastFuels v2 SDK.`resource.wait()` replaces the manual poll loop. It blocks until the resourcereaches `completed`, or raises if it `failed`."""
import fastfuels_sdk.v2 as fffrom fastfuels_sdk.v2.client_library.models import StemIsolationLmf
ff.set_api_key("my-api-key")
# 1 — the domain (Blackfoot River valley, EPSG:32612)domain = ff.Domain.from_geojson( { "type": "FeatureCollection", "crs": {"type": "name", "properties": {"name": "EPSG:32612"}}, "features": [ { "type": "Feature", "properties": {}, "geometry": { "type": "Polygon", "coordinates": [ [ [294095.0, 5198982.0], [294785.0, 5198982.0], [294785.0, 5199750.0], [294095.0, 5199750.0], [294095.0, 5198982.0], ] ], }, } ], }, name="Blackfoot River", description="About half a square kilometre of the Blackfoot River valley, Montana.",)print(f"domain {domain.id}")
# 2 — is there lidar here, and whose?coverage = ff.point_clouds.check_3dep_coverage(domain).to_dict()print(f"coverage {coverage['coverage_fraction']:.0%}, " f"~{coverage['estimated_point_count']:,} points estimated")
# 3 — fetch it, pinned to one acquisition so the run is reproduciblepoint_cloud = ff.point_clouds.create_point_cloud_from_3dep( domain, datasets=["MT_Statewide_P3_4_B21"], name="Blackfoot ALS (pinned)", description="Pinned to a single 3DEP acquisition so the fetch is reproducible.", tags=["blackfoot", "3dep"],)point_cloud.wait()summary = point_cloud.to_dict()["summary"]print(f"point cloud {point_cloud.id}: " f"{summary['point_count']:,} points, {summary['density']:.1f} pts/m2")
# 4 — rasterize the canopy surfacegrid = ff.grids.create_canopy_height_grid_from_point_cloud( point_cloud, name="Canopy height from 3DEP lidar", description="CHM rasterized from the pinned Blackfoot point cloud.", tags=["blackfoot", "chm"],)grid.wait()ground = grid.to_dict()["source"]["ground"]print(f"chm {grid.id}: ground from {ground['ground_source']}, " f"{ground['ground_coverage']:.1%} covered")
# 5 — one tree per treetopdetected = ff.inventories.create_tree_inventory_from_chm_grid( domain, grid, algorithm=StemIsolationLmf(min_height=2, footprint_size=5), name="Detected treetops",)detected.wait()print(f"detected {detected.id}: " f"{[c['key'] for c in detected.to_dict()['columns']]}")
# 6 — fill in what the CHM could not seeinventory = ff.inventories.create_tree_inventory_with_gdam_allometry( domain, detected, name="Fully attributed tree inventory",)inventory.wait()doc = inventory.to_dict()metrics = doc["forestry_metrics"]print(f"inventory {inventory.id}: {[c['key'] for c in doc['columns']]}")print(f" {metrics['tree_count']:,} trees, " f"{metrics['tree_density']:.0f} per acre, " f"QMD {metrics['quadratic_mean_diameter']:.1f} in")for group in metrics["dominant_species_groups"]: print(f" {group['basal_area_share']:.1%} {group['name']}")Next steps
Section titled “Next steps”- Remove the power-line detections — a spatial modification rule removes the trees inside a polygon drawn over the corridor. About modifications describes the inline-geometry form, and Remove trees under roads or water runs the same kind of rule against a feature.
- Correct or calibrate the inventory —
modify an inventory to
drop trees, reassign
fia_species_code, or scaledbh,height, orcrown_base_height. - Tune the detection —
inspect the detection and adjust
footprint_sizeandmin_heightuntil the treetops track the crowns you can see. - Understand what detection can and cannot resolve — how tree detection from a CHM works, including why a CHM sees only the dominant canopy.
- Build 3D fuel — voxelize the inventory
into a 3D canopy grid, the form a physics-based fire model consumes.
Voxelization requires
x,y,height,dbh,crown_base_height, andfia_species_code, and this inventory has all six. - Simulate a fire — create QUIC-Fire simulation inputs, which walks the same idea to a full input set.
- Start without lidar — build the CHM from NAIP or Meta imagery and rejoin at Step 5 with its id. Choosing a source compares them.
- Use your own lidar — upload a point cloud instead of fetching one, and rejoin at Step 4.