Remove trees with road, water and building features
You are viewing in-progress documentation for v2. Switch to the stable version for the current production release.
Remove trees that fall within a road, water or building Feature by testing
To remove trees near a road or water feature, or inside a building footprint,
pass a modification rule on the inventory create call: a feature condition and
a remove action. This is the inventory counterpart to
removing surface fuel under the same features.
For how conditions and actions work, see
About modifications.
Prerequisites
Section titled “Prerequisites”-
An API key: my-api-key.
-
A domain: your-domain-id. See Create a domain.
-
A completed road feature and water feature in that domain. See Create road and water features from OpenStreetMap and record your-road-feature-id and your-water-feature-id.
-
A completed PIM source grid. A TreeMap inventory is generated from a
pimgrid. Create one, poll it tocompleted, and record your-pim-grid-id:Create TreeMap PIM grid 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"}'Create TreeMap PIM grid and wait import fastfuels_sdk.v2 as ffff.set_api_key("my-api-key")domain = ff.Domain.from_id("your-domain-id")# A TreeMap PIM inventory is generated from a `pim` grid, so build one first.# It's coarse, so it completes quickly.pim_grid = ff.grids.create_pim_grid_from_treemap(domain, name="TreeMap PIM grid")pim_grid.wait()print(pim_grid.id, pim_grid.status){"id": "your-pim-grid-id","domain_id": "your-domain-id","name": "TreeMap PIM grid","description": "","status": "completed","progress": {"percent": 100,"message": "Complete"},"created_on": "2026-11-06T22:33:58.477550Z","modified_on": "2026-11-06T22:34:00.973261Z","checksum": "44473d57497e4237bd5d360e9cbd6e8e","source": {"product": "treemap","extent_buffer_cells": 0,"version": "2022","alignment": {"target": "domain","resolution": null,"method": null},"bands": ["tm_id"],"description": "TreeMap plot imputation raster (FIA plot IDs at 30m)","name": "pim"},"modifications": [],"bands": [{"key": "tm_id","name": "TreeMap ID","description": "TreeMap raster pixel value identifying the matched FIA plot (small integer, ~1-70k).","type": "categorical","unit": null,"index": 0,"nodata": 4294967295,"summary": {"type": "categorical","count": 794,"nodata_count": 308,"unique_count": 72}}],"georeference": {"crs": "EPSG:32612","transform": [29.70515810844862, 0.0, 272704.14070633065, 0.0, -29.70515810845998,5190569.722686225],"shape": [29, 38]},"error": null,"chunks": {"shape": [512, 512],"count": 1,"count_by_axis": {"y": 1,"x": 1}},"tags": []} -
To remove rooftop detections, a completed building feature and CHM grid in that domain. See Create building features and record your-building-feature-id. Build a NAIP CHM grid (
canopy/naip) as in Generate a tree inventory from a CHM and record your-chm-grid-id.
Remove trees near water
Section titled “Remove trees near water”To remove every tree within a distance of water, add one rule with a within
condition on the water feature, a buffer_m for the distance, and a remove
action. remove must be the only action in its rule.
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": "Trees with 5 m water buffer removed", "source_pim_grid_id": "your-pim-grid-id", "seed": 42, "modifications": [ { "conditions": [ {"source": "feature", "operator": "within", "feature_id": "your-water-feature-id", "buffer_m": 5} ], "actions": [ {"modifier": "remove"} ] } ]}'import fastfuels_sdk.v2 as ff
ff.set_api_key("my-api-key")
domain = ff.Domain.from_id("your-domain-id")
inventory = ff.inventories.create_tree_inventory_from_pim_grid( domain, "your-pim-grid-id", seed=42, name="Trees with 5 m water buffer removed", modifications=[ ff.remove_trees(ff.tree_within("your-water-feature-id", buffer_m=5)), ],)print(inventory.id, inventory.status){ "id": "your-inventory-id", "domain_id": "your-domain-id", "type": "tree", "name": "Trees with 5 m water buffer removed", "description": "", "status": "pending", "progress": null, "created_on": "2026-11-06T22:34:51.739428", "modified_on": "2026-11-06T22:34:51.739428", "checksum": "9fabb5d43d2e4617a4ff7532c93b1cc8", "source": { "name": "pim", "source_pim_grid_id": "your-pim-grid-id", "source_pim_grid_checksum": "44473d57497e4237bd5d360e9cbd6e8e", "point_process": "inhomogeneous_poisson", "seed": 42, "crown_base_height_model": { "name": "fia_national_logit_2026" } }, "modifications": [ { "conditions": [ { "source": "feature", "operator": "within", "feature_id": "your-water-feature-id", "buffer_m": 5.0 } ], "actions": [ { "modifier": "remove" } ] } ], "treatments": [], "columns": [ { "key": "tree_id", "type": "categorical", "unit": null, "summary": null }, { "key": "x", "type": "continuous", "unit": "m", "summary": null }, { "key": "y", "type": "continuous", "unit": "m", "summary": null }, { "key": "fia_species_code", "type": "categorical", "unit": null, "summary": null }, { "key": "fia_status_code", "type": "categorical", "unit": null, "summary": null }, { "key": "dbh", "type": "continuous", "unit": "cm", "summary": null }, { "key": "height", "type": "continuous", "unit": "m", "summary": null }, { "key": "crown_ratio", "type": "continuous", "unit": null, "summary": null }, { "key": "crown_base_height", "type": "continuous", "unit": "m", "summary": null } ], "forestry_metrics": null, "georeference": null, "error": null, "tags": []}The 201 returns your rule and mints an inventory id. Record it:
your-inventory-id. The removal runs while the inventory is built.
seed: 42 fixes the tree population, so a run with the rule and a run without
it can be compared tree for tree.
Poll until completed
Section titled “Poll until completed”Poll the inventory, or wait() on it:
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'import fastfuels_sdk.v2 as ff
ff.set_api_key("my-api-key")
inventory = ff.get_inventory("your-domain-id", "your-inventory-id")inventory.wait(){ "id": "your-inventory-id", "domain_id": "your-domain-id", "type": "tree", "name": "Trees with 5 m water buffer removed", "description": "", "status": "completed", "progress": { "percent": 100, "message": "Complete" }, "created_on": "2026-11-06T22:34:51.739428Z", "modified_on": "2026-11-06T22:34:57.736964Z", "checksum": "9fabb5d43d2e4617a4ff7532c93b1cc8", "source": { "point_process": "inhomogeneous_poisson", "source_pim_grid_id": "your-pim-grid-id", "crown_base_height_model": { "name": "fia_national_logit_2026" }, "name": "pim", "seed": 42, "source_pim_grid_checksum": "44473d57497e4237bd5d360e9cbd6e8e" }, "modifications": [ { "conditions": [ { "source": "feature", "operator": "within", "feature_id": "your-water-feature-id", "buffer_m": 5.0 } ], "actions": [ { "modifier": "remove" } ] } ], "treatments": [], "columns": [ { "key": "tree_id", "type": "categorical", "unit": null, "summary": { "type": "categorical", "count": 58497, "null_count": 0, "unique_count": 58497 } }, { "key": "x", "type": "continuous", "unit": "m", "summary": { "type": "continuous", "count": 58497, "null_count": 0, "min": 272704.1437620683, "max": 273811.88279792794, "mean": 273197.0648713965, "std": 316.4708571901422 } }, { "key": "y", "type": "continuous", "unit": "m", "summary": { "type": "continuous", "count": 58497, "null_count": 0, "min": 5189708.31769041, "max": 5190557.9572946, "mean": 5190217.123308139, "std": 208.46939555021478 } }, { "key": "fia_species_code", "type": "categorical", "unit": null, "summary": { "type": "categorical", "count": 58497, "null_count": 0, "unique_count": 14 } }, { "key": "fia_status_code", "type": "categorical", "unit": null, "summary": { "type": "categorical", "count": 58497, "null_count": 0, "unique_count": 2 } }, { "key": "dbh", "type": "continuous", "unit": "cm", "summary": { "type": "continuous", "count": 58497, "null_count": 0, "min": 2.54, "max": 93.218, "mean": 15.47585000940219, "std": 11.803385723448804 } }, { "key": "height", "type": "continuous", "unit": "m", "summary": { "type": "continuous", "count": 58497, "null_count": 0, "min": 1.2191999999999998, "max": 44.50079999999999, "mean": 10.916026134673572, "std": 6.738519007692292 } }, { "key": "crown_ratio", "type": "continuous", "unit": null, "summary": { "type": "continuous", "count": 58497, "null_count": 0, "min": 0.0, "max": 0.98, "mean": 0.42686736071935316, "std": 0.2641902911022181 } }, { "key": "crown_base_height", "type": "continuous", "unit": "m", "summary": { "type": "continuous", "count": 58497, "null_count": 0, "min": 0.013531389229825271, "max": 44.50079999999999, "mean": 5.011130878770436, "std": 4.649380506154495 } } ], "forestry_metrics": { "type": "tree", "tree_count": 58497, "basal_area_per_area": 80.53932530363515, "tree_density": 251.48711748843192, "quadratic_mean_diameter": 7.662710664305269, "dominant_species_groups": [ { "spgrpcd": 2, "name": "Douglas-fir", "basal_area_share": 0.51992615251096 }, { "spgrpcd": 4, "name": "Pine", "basal_area_share": 0.31691098258240824 }, { "spgrpcd": 1, "name": "Cedar/larch", "basal_area_share": 0.06898369329870435 }, { "spgrpcd": 6, "name": "Aspen/alder/cottonwood-willow", "basal_area_share": 0.035566322758673566 }, { "spgrpcd": 3, "name": "True fir/hemlock", "basal_area_share": 0.021309312484673857 } ] }, "georeference": { "crs": "EPSG:32612", "bounds": [ 272704.14070633065, 5189708.273101079, 273811.9841738697, 5190557.960119883 ] }, "error": null, "tags": []}On the Pattee Canyon domain the rule removes 1,347 of 59,844 trees, 1.7% of the domain’s basal area: the trees inside Pattee Creek and within 5 m of it. The map shows those trees and the trees the rule kept just outside the buffer.
Remove only large trees near a road
Section titled “Remove only large trees near a road”To remove only some of the trees near a feature, add a second condition to the
same rule. Conditions in a rule are ANDed, so a tree is removed only if it is
inside the buffered road and above the DBH threshold. This rule removes trees
over 10 in DBH within 5 m of a road. unit: "in" converts the threshold to
the native cm before the comparison.
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": "Large trees within 5 m of roads removed", "source_pim_grid_id": "your-pim-grid-id", "seed": 42, "modifications": [ { "conditions": [ {"source": "feature", "operator": "within", "feature_id": "your-road-feature-id", "buffer_m": 5}, {"attribute": "dbh", "operator": "gt", "value": 10, "unit": "in"} ], "actions": [ {"modifier": "remove"} ] } ]}'import fastfuels_sdk.v2 as ff
ff.set_api_key("my-api-key")
domain = ff.Domain.from_id("your-domain-id")
# Two conditions in one rule are ANDed: a tree is removed only if it's both# inside the buffered road *and* over the DBH threshold. `unit="in"` converts# 10 inches to the native cm before comparing.inventory = ff.inventories.create_tree_inventory_from_pim_grid( domain, "your-pim-grid-id", seed=42, name="Large trees within 5 m of roads removed", modifications=[ ff.remove_trees( ff.tree_within("your-road-feature-id", buffer_m=5), ff.tree_attribute("dbh", ">", 10, unit="in"), ), ],)print(inventory.id, inventory.status){ "id": "your-inventory-id", "domain_id": "your-domain-id", "type": "tree", "name": "Large trees within 5 m of roads removed", "description": "", "status": "pending", "progress": null, "created_on": "2026-11-06T22:35:02.836810", "modified_on": "2026-11-06T22:35:02.836810", "checksum": "d2dbe1e9f88c436c8700b403ac4c7255", "source": { "name": "pim", "source_pim_grid_id": "your-pim-grid-id", "source_pim_grid_checksum": "44473d57497e4237bd5d360e9cbd6e8e", "point_process": "inhomogeneous_poisson", "seed": 42, "crown_base_height_model": { "name": "fia_national_logit_2026" } }, "modifications": [ { "conditions": [ { "source": "feature", "operator": "within", "feature_id": "your-road-feature-id", "buffer_m": 5.0 }, { "attribute": "dbh", "operator": "gt", "value": 10, "unit": "in" } ], "actions": [ { "modifier": "remove" } ] } ], "treatments": [], "columns": [ { "key": "tree_id", "type": "categorical", "unit": null, "summary": null }, { "key": "x", "type": "continuous", "unit": "m", "summary": null }, { "key": "y", "type": "continuous", "unit": "m", "summary": null }, { "key": "fia_species_code", "type": "categorical", "unit": null, "summary": null }, { "key": "fia_status_code", "type": "categorical", "unit": null, "summary": null }, { "key": "dbh", "type": "continuous", "unit": "cm", "summary": null }, { "key": "height", "type": "continuous", "unit": "m", "summary": null }, { "key": "crown_ratio", "type": "continuous", "unit": null, "summary": null }, { "key": "crown_base_height", "type": "continuous", "unit": "m", "summary": null } ], "forestry_metrics": null, "georeference": null, "error": null, "tags": []}On the Pattee Canyon domain the rule removes 465 of 59,844 trees, with a median DBH of 13.5 in. They hold 3.0% of the domain’s basal area. The 1,817 trees of 10 in DBH or less inside the same buffer stay, with a median DBH of 4.4 in. Without the DBH condition, the rule removes every tree in the buffer.
Remove CHM detections inside building footprints
Section titled “Remove CHM detections inside building footprints”The NAIP CHM records rooftops as height, so a tree inventory detected from it
places trees on roofs. To remove them, create the CHM inventory with one rule:
a within condition on the building feature and a remove action.
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": "CHM trees with rooftop detections removed", "source_chm_grid_id": "your-chm-grid-id", "algorithm": { "name": "lmf", "min_height": 2, "footprint_size": 3 }, "modifications": [ { "conditions": [ {"source": "feature", "operator": "within", "feature_id": "your-building-feature-id"} ], "actions": [ {"modifier": "remove"} ] } ]}'import fastfuels_sdk.v2 as fffrom fastfuels_sdk.v2.client_library.models import StemIsolationLmf
ff.set_api_key("my-api-key")
domain = ff.Domain.from_id("your-domain-id")
inventory = ff.inventories.create_tree_inventory_from_chm_grid( domain, "your-chm-grid-id", algorithm=StemIsolationLmf(min_height=2, footprint_size=3), name="CHM trees with rooftop detections removed", modifications=[ ff.remove_trees(ff.tree_within("your-building-feature-id")), ],)print(inventory.id, inventory.status){ "id": "your-inventory-id", "domain_id": "your-domain-id", "type": "tree", "name": "CHM trees with rooftop detections removed", "description": "", "status": "pending", "progress": null, "created_on": "2026-11-06T22:35:08.575550", "modified_on": "2026-11-06T22:35:08.575550", "checksum": "7d8b55b3671f416abcb9fd6c14ea5cc8", "source": { "name": "chm", "source_chm_grid_id": "your-chm-grid-id", "source_chm_grid_checksum": "ceaf0fe59b0a4ad89276a94dd65f19d4", "algorithm": { "name": "lmf", "min_height": 2.0, "max_height": 120.0, "footprint_size": 3 }, "crown_segmentation": null }, "modifications": [ { "conditions": [ { "source": "feature", "operator": "within", "feature_id": "your-building-feature-id", "buffer_m": null } ], "actions": [ { "modifier": "remove" } ] } ], "treatments": [], "columns": [ { "key": "tree_id", "type": "categorical", "unit": null, "summary": null }, { "key": "x", "type": "continuous", "unit": "m", "summary": null }, { "key": "y", "type": "continuous", "unit": "m", "summary": null }, { "key": "height", "type": "continuous", "unit": "m", "summary": null } ], "forestry_metrics": null, "georeference": null, "error": null, "tags": []}Record the inventory id, your-inventory-id, and
poll it to completed.
On the Pattee Canyon domain the rule removes 58 of 11,858 detections, in 19 of the 25 footprints. The removed detections have a median height of 5.0 m. The 139 detections kept within 10 m of a building have a median height of 10.8 m, and all detections 15.0 m.
A tree whose crown overhangs a roof can have its top detected inside the
footprint, and the rule removes it too. To also remove detections along the
roof edges, add buffer_m to the condition.
Common pitfalls
Section titled “Common pitfalls”removecombined with another action.removemust be the only action in its rule, and the API rejects any other combination. To edit some trees and remove others, use two rules.- Expecting no
buffer_mto catch trees beside water. It catches only the trees inside water polygons. Set a buffer to reach the trees beside them. - Wrong DBH units. DBH is stored in cm, so a bare
"value": 10means 10 cm. Add"unit": "in"when you mean inches. - A feature from another domain. The feature must belong to the same domain as the inventory, or the request is rejected.
Next steps
Section titled “Next steps”- Remove surface fuel under roads, water and buildings to remove surface fuel under the same features.
- About modifications for the
operators,
buffer_mand how rules combine.