Skip to content

Create a crown Feature from a CHM

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

This guide shows you how to outline each tree’s crown on a canopy height model (CHM) and store the outlines as a crown Feature. A crown Feature holds one polygon per tree, matched to the tree by tree_id. Its main use is to voxelize an inventory with measured crown shapes. For what measured crowns change in a voxel canopy, see Where crown geometry comes from.

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

  2. A domain: your-domain-id.

  3. A completed CHM grid with a chm band in meters, at 2 m resolution or finer: your-chm-grid-id. NAIP, Meta, and point-cloud CHMs all qualify. See Generate a tree inventory from a CHM.

  4. A completed tree inventory detected from that CHM grid with POST /inventories/tree/chm: your-chm-inventory-id. See Step 2 of the CHM guide.

The responses and figures on this page come from a 400 m × 400 m domain in an open conifer stand north of the Blackfoot River, Montana. The CHM is rasterized from 3DEP lidar on the 0.6 m lattice of a NAIP CHM grid, and 2,253 trees were detected on it by vwf.

POST to features/crown/chm with the inventory and the CHM grid. Each tree seeds one crown in the CHM cell under its x, y, and the crown grows outward until it reaches the crown’s edge. Crowns never overlap.

POST features/crown/chm
curl -X 'POST' \
'https://api-v2-prod-nyvjyh5ywa-uw.a.run.app/domains/your-domain-id/features/crown/chm' \
-H 'accept: application/json' \
-H 'api-key: my-api-key' \
-H 'Content-Type: application/json' \
-d '{
"name": "Crowns from CHM",
"source_inventory_id": "your-chm-inventory-id",
"source_chm_grid_id": "your-chm-grid-id"
}'

Record the Feature id: your-crown-feature-id.

The defaults of crown_segmentation are in the response. To change how far a crown can grow, set fields such as max_crown_radius (m) or min_height (m) in crown_segmentation. The API reference lists every field.

Poll until the status is completed:

GET feature status
curl -X 'GET' \
'https://api-v2-prod-nyvjyh5ywa-uw.a.run.app/domains/your-domain-id/features/your-crown-feature-id' \
-H 'accept: application/json' \
-H 'api-key: my-api-key'

Each crown is a polygon traced along CHM cell edges. Look for one outline around each tree top, following the edge of the crown in the CHM.

Left: a 60 by 60 metre window of the lidar canopy height model, separate green crowns on cream ground, with dark stair-stepped crown outlines and a pink dot at each tree top; each dot sits inside its own outline, the large crowns are round, the small ones are a few cells across, and outlines meet only where crowns touch. Right: a histogram of crown area for all 2,253 crowns, highest below 2 square metres and falling off steadily to about 65, with a median of 13 square metres.

Left: the lidar CHM with each crown outline (dark) and the tree top that seeded it (pink). Where two crowns touch, each CHM cell belongs to one of them. Right: the area of every crown in the Feature.

The map shows a 150 m square of the domain. Click a tree top for its height and crown_radius.

150 m square Crowns Tree tops
Crown outlines (white) and tree tops (pink) over aerial imagery, in a 150 m square (dashed) of the Blackfoot River domain.

The crowns stream as GeoJSON in the domain’s CRS, in partitions. Each feature has a tree_id property and a Polygon. In the SDK, to_geodataframe() reads every partition.

GET the crown polygons
# How many crowns, and in how many partitions.
curl -X 'GET' \
'https://api-v2-prod-nyvjyh5ywa-uw.a.run.app/domains/your-domain-id/features/your-crown-feature-id/data/metadata' \
-H 'accept: application/json' \
-H 'api-key: my-api-key'
# The crowns in partition 0, as GeoJSON in the domain CRS.
curl -X 'GET' \
'https://api-v2-prod-nyvjyh5ywa-uw.a.run.app/domains/your-domain-id/features/your-crown-feature-id/data/0' \
-H 'accept: application/geo+json' \
-H 'api-key: my-api-key'

Here every tree got a crown: 2,253 crowns for 2,253 trees. A tree gets no crown if it lies outside the CHM, sits on a no-data cell, or shares its CHM cell with a taller tree. A tree below min_height gets a one-cell crown.

  • CHM coarser than 2 m. The CHM grid must be at 2 m resolution or finer, or the request returns 422. A 30 m LANDFIRE canopy grid can’t outline crowns.
  • Grid or inventory not completed. Poll both to completed first.
  • Deleting the CHM grid. Voxelizing with the Feature reads the crowns’ tops from its CHM grid, so keep the grid while you use the Feature.