About modifications
You are viewing in-progress documentation for v2. Switch to the stable version for the current production release.
A modification is a stored rule that edits a grid or a tree inventory.
Each rule pairs conditions (predicates that select which cells or trees
to act on) with actions (what to do to those cells or trees). The rule
travels with the resource. It is stored in the grid or inventory document’s
modifications list, which records every rule applied to the resource in
the order it was applied. The API is the place where modifications are
defined. The griddle and standgen services are where they are executed.
This page is about the shape of those rules — what a condition is, what an action is, why grids and inventories use slightly different vocabularies for each, when to reach for an inline geometry versus a persisted Feature reference, and the difference between applying a rule at create time and applying it in place to an existing resource. It does not show how to write a particular request. For that, see the how-to guides — modify a grid, modify an inventory, mask a fuel grid with features, and remove trees with features.
The anatomy of a rule
Section titled “The anatomy of a rule”A modification has exactly two parts:
{ "conditions": [ /* zero or more — ANDed; empty selects every item */ ], "actions": [ /* all applied to matching items */ ]}Conditions are joined with logical AND: every condition must be satisfied
for an item to match. Adding a condition to a rule narrows the selection
— it’s the intersection of all the conditions. There is no OR operator
within a rule. To act on a union — “roads or water”, “GR1 or GR2” —
write multiple rules: each is applied independently, so adding a rule
widens the overall selection. The resource carries a list of rules. A
create call accepts a modifications array, the in-place /modifications
endpoints accept one, and the rules in an array are applied in order.
It follows that putting a road-feature condition and a water-feature condition in a single rule selects cells that are inside a road and a water body at the same time — almost always none. Two features means two rules.
An empty conditions list is the limiting case of that narrowing: with
no predicate to satisfy, every item matches, and the rule’s actions apply to
the whole resource — every cell of the grid, every tree in the inventory.
This is how a blanket change is expressed: subtract a constant from every
cell, scale an entire band, or — paired with the inventory RemoveAction —
clear an inventory outright. Adding any condition narrows it back to a
subset. (An inventory rule must carry at least one action. A rule with an
empty actions list is rejected.)
Actions run on items the conditions select. For a grid, the items are
cells. For an inventory, the items are individual trees. A single rule can
carry several actions, and they are applied together. The only exception is
the inventory RemoveAction, which is destructive and must therefore be the
sole action in its rule.
The four condition kinds
Section titled “The four condition kinds”The conditions array is heterogeneous — a single rule can mix kinds. Across the two resources there are four distinct condition shapes:
| Kind | Grids | Inventories | What it tests |
|---|---|---|---|
| Attribute | ✅ | ✅ | A single field compared against a value (band/attribute op value) |
| Expression | ✅ | A boolean expression over multiple tree attributes | |
| Spatial — geometry | ✅ | ✅ | The item’s location against an inline GeoJSON geometry |
| Spatial — feature | ✅ | ✅ | The item’s location against a persisted Feature resource |
Attribute conditions
Section titled “Attribute conditions”An attribute condition names a field, an operator, and a value.
// Grid — flag cells where the 1-hour fuel load is above 1.5 kg/m**2{ "band": "fuel_load.1hr", "operator": "gt", "value": 1.5 }
// Inventory — pick out trees taller than 30 m{ "attribute": "height", "operator": "gt", "value": 30 }Operators are eq, ne, gt, lt, ge, le. Two constraints apply:
- A list-valued
valueis only meaningful witheqorne(it asks “is the field one of these?”). An inventory condition that combines a list withgt/lt/etc. is rejected at validation time. A grid condition that does so is accepted, and the grid job fails withINVALID_OPERATOR. - The inventory attributes
fia_species_codeandtree_idonly accepteqandne— ordering species codes or tree ids numerically is not a meaningful test.
Inventory attribute conditions also carry an optional unit field. The
attribute’s native unit is fixed (dbh is cm, height is m), but a request
can declare "unit": "in" and the server will pint-convert the value into
the native unit before comparing. A request can therefore use imperial
inputs without converting them first. The conversion is rejected if the
supplied unit is dimensionally incompatible.
Expression conditions (inventory only)
Section titled “Expression conditions (inventory only)”Expression conditions exist because attribute conditions can only test one field at a time, and many tree-level predicates touch several fields at once.
{ "expression": "dbh < 5 and height < 2" }The expression is parsed with a restricted Python AST: only the names
dbh, height, and crown_base_height are allowed, no function calls, no
attribute access, no imports. fia_species_code is deliberately excluded
because it is categorical — combining it with arithmetic would be
ill-defined. Expressions also have no unit knob. Values are always in
native units (cm for dbh, m for height and crown_base_height). For
imperial inputs, convert in the expression itself.
Grids do not have an expression kind. A grid cell’s bands are independent — there is no equivalent of “this tree’s height and its dbh” because each band is a separate raster. Compounding across bands is handled by writing two attribute conditions in the same rule.
Spatial conditions — inline geometry
Section titled “Spatial conditions — inline geometry”A spatial condition asks: where is this item, relative to a shape? The inline variant carries the shape directly in the request body as a GeoJSON geometry.
{ "source": "geometry", "operator": "within", "geometry": { "type": "Polygon", "coordinates": [ /* ... */ ] }, "buffer_m": 5}Inline geometry is the right tool for one-off shapes: a polygon drawn by hand to mask a single small zone, or a shape derived programmatically that will not be reused. The geometry travels in the request body and is stored verbatim on the resource document, so the rule is fully self-describing — nothing external needs to exist to see what shape the rule used.
CRS is declared either through GeoJSON’s crs object or implicitly via the
domain. When the request omits crs, the server interprets the coordinates
in the domain’s CRS. This matches the convention used by the rest of the
v2 API: anything spatial defaults to “in the domain’s frame.”
Spatial conditions — feature reference
Section titled “Spatial conditions — feature reference”The feature variant points at a persisted Feature resource by id instead of carrying the shape inline.
{ "source": "feature", "operator": "intersects", "feature_id": "feat_road_abc", "buffer_m": 4}The processing service resolves the id, loads the Feature’s geometry, reprojects it into the domain CRS, optionally buffers it, and then evaluates the spatial operator. This is the right tool whenever the shape already exists as a Feature — typically a road network or a water body extracted from OSM, or a layerset polygon that was uploaded for some other purpose.
The trade-offs between the two variants are discussed below in Feature references versus inline geometry.
The action vocabulary
Section titled “The action vocabulary”Once a rule has selected its items, it applies one or more actions.
For grids, every action transforms a band’s value at the matching cells:
{ "band": "fuel_load.1hr", "modifier": "replace", "value": 0 }{ "band": "fuel_load.1hr", "modifier": "multiply", "value": 0.1 }The five modifiers — multiply, divide, add, subtract, replace — cover
the common transforms: zeroing a band, scaling it down, shifting it by a
constant, or replacing it outright. There is no “remove” for grids: a grid cell
always exists at its location in the lattice, and a modification can only change
its value, never delete the cell itself.
Inventories carry the same five modifiers plus a sixth, destructive option:
{ "modifier": "remove" } // delete matching trees{ "attribute": "height", "modifier": "multiply", "value": 0.9 } // shrink survivorsRemoveAction deletes matching trees from the inventory rather than
editing their attributes. Because deletion and attribute editing don’t
compose meaningfully — “remove this tree, and also set its height” is
incoherent — the schema enforces that a rule containing a remove action
contains only that action.
Like attribute conditions, inventory actions optionally carry a unit for
unit conversion. Grid actions do not, because grid bands have a single
canonical unit declared on the band itself. An inventory divide action
with a value of zero is rejected at validation time.
Grid versus inventory: why they differ
Section titled “Grid versus inventory: why they differ”The two resources accept structurally similar rule documents, with these differences:
-
Field name. Grids use
band(a dot-notation key like"fuel_load.1hr"or"fbfm"). Inventories useattribute(a closed enum:dbh,height,crown_base_height,fia_species_code,tree_id).tree_idselects trees in conditions only and cannot be the target of an action. A grid’s bands are open-ended — the set depends on what data the grid carries — so a string field is the only option. Tree attributes are fixed by the rasterizer’s contract. -
Spatial target. Grid spatial conditions carry a
targetfield (centroidorcell) controlling which part of each cell is tested against the geometry. Inventory spatial conditions do not, because a tree is a point — there is nothing to choose. Grids are cells with footprints. Inventories are points. -
Removal. Inventories have a destructive
RemoveAction. Grids do not. See above. -
Units on values. Inventory conditions and actions accept a
unitfield for pint-based conversion. Grid conditions and actions do not. -
Expression conditions. Inventory only. Grid bands are independent. Cross-band conjunction is expressed by stacking attribute conditions in the same rule.
Feature references versus inline geometry
Section titled “Feature references versus inline geometry”When a shape is already persisted as a Feature, both source: "feature" and
source: "geometry" work — you could re-export the Feature’s geometry into the
request body. The schema accepts either. Prefer source: "feature" whenever the
shape is or could be reused, and reserve source: "geometry" for one-off
shapes. The reasons:
-
Single source of truth. A road network exists in exactly one place (the road Feature), and every rule that references it points at that one stored geometry. With inline geometry, each request carries its own copy of the shape, and the copies can drift apart across requests.
-
Payload size. Roads and water bodies pulled from OSM can be large. Inlining them inflates every grid or inventory document. A feature id is a string.
-
Auditability. A persisted Feature carries provenance — the OSM tags it was filtered from, the buffer it was extracted with, who uploaded it. An inline geometry has no provenance beyond what the requester chose to put in its
propertiesblock. -
Reprojection happens once, server-side. Both variants are reprojected into the domain CRS at evaluation time, but the feature variant uses the Feature’s stored, canonicalized CRS, so the request body doesn’t have to carry CRS metadata.
Use inline geometry when the shape is ephemeral — an experiment, a hand-drawn polygon over a single AOI, or a derived shape (e.g., the output of a per-request buffer-and-merge pipeline) that is not worth persisting as a Feature.
A constraint that applies to both: the Feature must live in the same domain as the grid or inventory being modified. Cross-domain references are rejected at submit time. A domain is the unit of geographic scope in v2, and modifications that reached across domains would make resource lineage harder to trace.
buffer_m semantics
Section titled “buffer_m semantics”Both spatial variants carry an optional buffer_m. The number is in
meters in the domain’s projected CRS — not degrees, not the geometry’s
native CRS. This is one of the few places in the v2 API where the user
supplies a distance.
A buffer of 0 is the same as no buffer: the operator is evaluated
against the literal geometry. A buffer of 5 widens the geometry by 5 m on
every side before the test, so cells or trees within 5 m of the original
shape now match within/intersects, and a cell 4 m outside a road
becomes “inside the buffered road.” The buffer is applied uniformly — a
linestring becomes a strip, a point becomes a disk, a polygon becomes a
fatter polygon.
The buffer matters most when the shape is narrow relative to the things being tested. Four cases:
-
Narrow features against tree inventories. Road Features are stored as polygons — the OSM extractor widens road centerlines into footprint polygons by road class — but a road footprint is still only a few meters wide. Trees are points, and a point rarely lands inside such a thin polygon, so a
withintest with no buffer catches very few trees.buffer_mis how you give the feature enough width to match: its value expresses the real corridor — a 4 m single-lane road, an 8 m paved road, a 20 m+ highway with shoulders, or a shoreline tolerance around water. -
Narrow features against grids. Grids have two modes. With
target: "cell", the entire cell footprint is tested, so a buffer is not required — every cell the road polygon touches is captured byintersects. Withtarget: "centroid"(the default), the cell is reduced to its center point and the narrow-feature problem reappears: a road that clips the corner of a cell may miss its centroid. To mask every cell the road touches, usetarget: "cell"with no buffer. To mask every cell within a right-of-way, usebuffer_m: <ROW width>. -
Inline linestrings. A bare
LineStringsupplied viasource: "geometry"has zero area, so on its own it matches almost nothing — every tree point, and (undertarget: "cell" + within) every grid cell, fails the test. A non-zerobuffer_mturns the line into a strip, so the condition needs one to match. (Persisted road Features avoid this because they’re already widened to polygons.) -
Large polygons. A lake, a managed plot, a fuel layerset polygon — these have ample area, and
intersectsagainst a cell or a tree matches without a buffer. A buffer here expresses tolerance — shoreline slack, polygon-edge margin — not a way to escape a thin-geometry miss.
Compound conditions
Section titled “Compound conditions”Because the conditions array is ANDed, the four kinds compose freely inside a single rule. Two examples:
// Remove only large trees that fall inside a road buffer{ "conditions": [ { "attribute": "dbh", "operator": "gt", "value": 30 }, { "source": "feature", "operator": "intersects", "feature_id": "feat_road_abc", "buffer_m": 4 } ], "actions": [{ "modifier": "remove" }]}
// Halve the 1-hour fuel load inside a polygon AND only where the// existing load is above 1.0 kg/m**2 (don't amplify near-zero noise){ "conditions": [ { "band": "fuel_load.1hr", "operator": "gt", "value": 1.0 }, { "source": "geometry", "operator": "within", "geometry": { /* ... */ } } ], "actions": [ { "band": "fuel_load.1hr", "modifier": "multiply", "value": 0.5 } ]}There is no OR. Multiple rules express disjunction. Two rules that
match the same item run in sequence — the second rule sees the output of the
first, which means rule order matters for non-commutative actions
(multiply after replace is not the same as replace after
multiply).
Create-time versus in-place
Section titled “Create-time versus in-place”The same rule document can be applied at two different moments:
- Create-time. A grid or inventory create request accepts a
modificationsarray. The rules are stored on the resource and applied as it is first built from its source — the LANDFIRE fetch, the TreeMap point process, the voxelization. The modification is part of the initial derivation. - In-place. A completed resource can be modified after the fact with
POST /domains/{id}/grids/{grid_id}/modificationsorPOST /domains/{id}/inventories/{inventory_id}/modifications. The submitted rules are appended to the resource’s existing list and applied to its current stored data — the bytes already in storage.
The two differ in what the in-place endpoint reads. It does not re-fetch the upstream source. It reads the array (or the tree table) the resource already holds, applies the new rules, and writes the result back under the same id. A cell or tree that no rule touches is therefore byte-identical afterward — even if LANDFIRE, 3DEP, or TreeMap has since published a new version. In-place modification edits an artifact. It never re-derives one.
Metadata (name, description, tags) is not accepted on the in-place
endpoints — the resource keeps its identity. Use PATCH to rename.
Ledger and staleness
Section titled “Ledger and staleness”Every resource carries a checksum, a random value the API replaces whenever
the resource’s data changes. The in-place endpoints rotate it the moment you
POST, so anything derived from the resource (a resample, an FBFM lookup, an
export) can compare checksums and detect that its input drifted underneath
it.
The rules themselves land in the resource’s modifications list once
processing completes, not on submit. The POST returns immediately with
status: pending and the rotated checksum, but the
modifications array still reflects the pre-submit state until the job
finishes. Poll the resource to completed to see the appended rules.
Branching a scenario
Section titled “Branching a scenario”Because in-place modification is append-only — it never removes or re-orders
existing rules — the way to explore a variant without disturbing the
original is to duplicate first, then modify the copy. POST .../duplicate makes a byte-for-byte clone: it carries the resource’s
source, modifications, and checksum over verbatim. It is a copy of the
stored artifact, not a re-derivation, so the clone is guaranteed identical to
its parent at the instant it was taken. Applying in-place modifications to
the copy then diverges it while the original stays exactly as it was.
Reproducibility and persistence
Section titled “Reproducibility and persistence”Modifications are part of the resource’s lineage. The create payload’s
modifications list is stored on the resource document and applied in full
when the resource is first built from its source. Each in-place call applies
only its own rules, to the stored data, and then appends them to the same
list. The list is a ledger of what was applied, so:
- The output of each step is a deterministic function of
(input data, modifications)— the source data and the full list at create time, or the stored data and the new rules at in-place time. - The in-place endpoints only append. Removing or re-ordering rules is not an in-place operation. To drop a rule you rebuild from a fresh create call (or branch before you append, keeping the earlier state as a separate resource).
- A rule that references a Feature stores only its id. A Feature’s
geometry cannot be changed after creation (
PATCHedits onlyname,description, andtags), so the id names the same shape for as long as the Feature exists.
Related: treatments
Section titled “Related: treatments”Inventories carry a parallel concept, treatments, with a vocabulary
distinct from modifications. Treatments model
silvicultural operations — thinning to a target basal area or target
diameter — with their own rule shape (metric, method, value,
conditions) rather than the condition/action pairs above. Like
modifications, they come in both forms: a create-time treatments field on
pim and chm inventory create requests, and an in-place endpoint,
POST /domains/{id}/inventories/{inventory_id}/treatments.
The two systems are separate endpoints with separate schemas. Don’t POST a
thinning treatment to .../modifications, and don’t try to express a stand
thinning as a remove/multiply modification. Use treatments when the
operation is silvicultural, and modifications when you’re editing
attributes, masking by feature, or removing trees by predicate.
Where to go next
Section titled “Where to go next”For step-by-step recipes against real endpoints:
- Modify a grid — reclassify fuel models, mask fuel under roads and water, on an existing grid.
- Modify an inventory — remove or adjust trees on an existing inventory.
- Remove surface fuel under roads, water and buildings and Remove trees with features — the create-time analogs, applied as the resource is first built.
The schema itself is documented in the OpenAPI surface — Swagger UI shows
the exact field types, validators, and json_schema_extra examples for
every variant covered above.