BDS — Auto Calculate Tree Selection

Trend → BDS → Auto. One call returns all three harvest regimes (Heavy / Medium / Light), each with its selected trees, residual stand, logging damage, and a 30-year projection.

Base URL: https://api.wildvine.kotaksakti.com
Setup first. The Hectare + Year inputs come from the shared /v3/bds/compartments and /v3/bds/years endpoints, and the user reaches this page from /v3/bds/simulation (BDS Page 1). See the Overview.

Page flow

#Page / screenWhat the user doesEndpoint(s)
0SetupPick Hectare + Year.GET /v3/bds/compartments
GET /v3/bds/years
1BDS Simulation (Pre-Felling)Reviews PF inventory, then taps Auto calculate.GET /v3/bds/simulation
2Auto result — Heavy / Medium / LightToggles between the three regimes; reads harvest list, residual stand, logging damage, and the 30-yr chart.GET /v3/bds/auto-selection (all three regimes in one response)

GET/v3/bds/auto-selection

Auto Calculate Tree Selection — returns all three regimes (Heavy / Medium / Light) in one response. Each regime block has the harvest list, totals row, Immediate Implication (residual stand), Logging Damage breakdown, and the 30-year Future Implication chart data.

Parameters

NameTypeRequiredDescription
yearintegerrequiredCensus year, e.g. 2021. Get valid values from /v3/bds/years.
compartment_hectareintegerrequired2 or 50

Business rules

RuleValue
Heavy regime target20 trees/ha × compartment_hectare
Medium regime target16 trees/ha × compartment_hectare
Light regime target12 trees/ha × compartment_hectare
Selection orderCandidate trees sorted by DBH descending; take top N
Logging damage (+60cm)20% of remaining trees in class removed
Logging damage (45-60cm)30% removed
Logging damage (30-45cm)40% removed
Logging damage (15-30cm)50% removed (skipped in practice — PF residual is DBH≥30)
LD selection within classSmallest-DBH trees dropped first
Future projection30 years, every 5 years (6 data points)

Example request

curl "https://api.wildvine.kotaksakti.com/v3/bds/auto-selection?year=2021&compartment_hectare=2"

Response structure

{
  "regimes": {
    "heavy":  RegimeBlock,   // 20 trees/ha
    "medium": RegimeBlock,   // 16 trees/ha
    "light":  RegimeBlock    // 12 trees/ha
  },
  "meta": {
    "compartment_hectare": integer,
    "year":                integer,
    "updated_at":          "ISO-8601 string"
  }
}

RegimeBlock = {
  "config": {
    "regime":             "heavy" | "medium" | "light",
    "trees_per_ha":       integer,   // 20 / 16 / 12
    "target_total":       integer,   // trees_per_ha * compartment_hectare
    "actually_selected":  integer    // capped by candidate pool size
  },

  // ─── Per-tree harvest list (drives the table on the Auto page) ───
  "selected_trees": [
    {
      "tag":             string,
      "scientific_name": string,
      "species_group":   string,
      "dbh_cm":          float,
      "basal_area_m2":   float,
      "volume_m3":       float,
      "biomass_t":       float,
      "carbon_tC":       float,
      "price_rm":        float
    }
  ],

  // ─── Totals row at the bottom of selected_trees ───
  "selected_total": {
    "tree_count":               integer,
    "basal_area_m2":            float,
    "basal_area_m2_per_ha":     float,
    "volume_m3":                float,
    "volume_m3_per_ha":         float,
    "total_biomass_t":          float,
    "total_biomass_t_per_ha":   float,
    "total_carbon_tC":          float,
    "total_carbon_tC_per_ha":   float,
    "price_rm":                 float
  },

  // ─── Right-side "Immediate Implication / Residual Stand" panel ───
  "residual_stand": {
    "tree_density":             integer,
    "tree_density_per_ha":      float,
    "volume_m3_per_ha":         float,
    "basal_area_m2_per_ha":     float,
    "total_biomass_t_per_ha":   float,
    "total_carbon_tC_per_ha":   float
  },

  // ─── Logging Damage breakdown (diagnostic) ───
  "logging_damage": {
    "by_dbh_class": [
      { "class": "+60cm",   "removed_pct": 20, "trees_removed": integer },
      { "class": "45-60cm", "removed_pct": 30, "trees_removed": integer },
      { "class": "30-45cm", "removed_pct": 40, "trees_removed": integer },
      { "class": "15-30cm", "removed_pct": 50, "trees_removed": integer }
    ],
    "total_trees_removed": integer
  },

  // ─── "Future Implication" 5-year line charts (next 30 years) ───
  "future_implication": {
    "years":                integer[6],   // [year+5, +10, +15, +20, +25, +30]
    "tree_density_per_ha":  float[6],
    "volume_m3_per_ha":     float[6],
    "basal_area_m2_per_ha": float[6],
    "biomass_t_per_ha":     float[6],
    "carbon_tC_per_ha":     float[6]
  }
}

Example response (Heavy regime only, 2ha 2021)

{
  "regimes": {
    "heavy": {
      "config": {
        "regime": "heavy",
        "trees_per_ha": 20,
        "target_total": 40,
        "actually_selected": 32
      },
      "selected_trees": [
        {
          "tag": "3010",
          "scientific_name": "Koompassia malaccensis",
          "species_group": "Non-dipterocarp",
          "dbh_cm": 119.6,
          "basal_area_m2": 1.12359,
          "volume_m3": 14.60669,
          "biomass_t": 24.12313,
          "carbon_tC": 11.33787,
          "price_rm": 464.83
        },
        {
          "tag": "2378",
          "scientific_name": "Sarcotheca griffithii",
          "species_group": "Non-dipterocarp",
          "dbh_cm": 112.4,
          "basal_area_m2": 0.99238,
          "volume_m3": 12.90096,
          "biomass_t": 20.82428,
          "carbon_tC": 9.78741,
          "price_rm": 414.83
        }
        // ... up to actually_selected rows
      ],
      "selected_total": {
        "tree_count": 32,
        "basal_area_m2": 15.39787,
        "basal_area_m2_per_ha": 7.69893,
        "volume_m3": 176.38323,
        "volume_m3_per_ha": 88.19161,
        "total_biomass_t": 288.74247,
        "total_biomass_t_per_ha": 144.37124,
        "total_carbon_tC": 135.70896,
        "total_carbon_tC_per_ha": 67.85448,
        "price_rm": 16026.44
      },
      "residual_stand": {
        "tree_density": 97,
        "tree_density_per_ha": 48.5,
        "volume_m3_per_ha": 58.1,
        "basal_area_m2_per_ha": 7.9,
        "total_biomass_t_per_ha": 122.31,
        "total_carbon_tC_per_ha": 57.49
      },
      "logging_damage": {
        "by_dbh_class": [
          { "class": "+60cm",   "removed_pct": 20, "trees_removed": 4 },
          { "class": "45-60cm", "removed_pct": 30, "trees_removed": 12 },
          { "class": "30-45cm", "removed_pct": 40, "trees_removed": 42 },
          { "class": "15-30cm", "removed_pct": 50, "trees_removed": 0 }
        ],
        "total_trees_removed": 58
      },
      "future_implication": {
        "years":                [2026, 2031, 2036, 2041, 2046, 2051],
        "tree_density_per_ha":  [43.55, 39.16, 35.63, 33.00, 31.14, 29.90],
        "volume_m3_per_ha":     [61.20, 63.80, 66.10, 68.00, 69.50, 70.70],
        "basal_area_m2_per_ha": [8.57, 8.62, 8.70, 8.81, 8.93, 9.01],
        "biomass_t_per_ha":     [130.20, 135.40, 139.80, 143.50, 146.70, 149.20],
        "carbon_tC_per_ha":     [61.20, 63.60, 65.70, 67.40, 68.90, 70.10]
      }
    },
    "medium": { /* same shape, 16 trees/ha target */ },
    "light":  { /* same shape, 12 trees/ha target */ }
  },
  "meta": {
    "compartment_hectare": 2,
    "year": 2021,
    "updated_at": "2026-06-04T08:00:00Z"
  }
}
actually_selected < target_total means the candidate pool was smaller than the regime's target. E.g. 50ha 2011 has only 44 candidate trees — Heavy wants 1000, gets 44. UI may want to surface this so users know the harvest is pool-limited.
Auto vs Manual. Auto picks the trees for you (top-N by DBH per regime). If the user wants to hand-pick instead, that's the Manual flow — same response shape, minus the Heavy/Medium/Light wrapper.

Last updated 2026-06-09 · Hosted on Cloudflare Pages