Matches trees from a LiDAR-derived dataset (e.g., ALS or TLS) to trees from a field inventory by solving a Linear Sum Assignment Problem (LSAP) in 3D space. The third dimension (Z) is artificially constructed from DBH or tree height to improve the accuracy of positional matching. To allow partial matching (i.e., unmatched trees), dummy trees are added with a fixed cost (unmatch_cost). This prevents the algorithm from forcing poor matches.

lsap_matching(
  treemap,
  dxymax = 2,
  dzmax = 0.05,
  zrel = 40,
  unmatch_cost = "auto"
)

guess_unmatch_cost(treemap, dxymax, dzmax, zrel, ...)

lsap_app(treemap)

Arguments

treemap

A TreeMapMatching object. See make_mapmatching.

dxymax

Maximum allowed 2D (XY) distance (in projection units) for a valid match.

dzmax

Maximum allowed Z difference (e.g., DBH or height, in meters) for a valid match.

zrel

Relative importance of the Z dimension compared to XY. Since Z and XY units differ, Z is scaled to be comparable. A value of 0 means Z is ignored; a value of 1 gives Z and XY equal weight. Default is 0.5 (i.e., 50% of XY weight).

unmatch_cost

Fixed cost of assigning a tree to a dummy (i.e., unmatched). See Details.

...

unused

Value

A data.table with the following columns:

index_measure

Index of the matched tree in the measured (LiDAR) dataset.

index_inventory

Index of the matched tree in the inventory dataset, or NA if unmatched.

Only matches that satisfy the distance thresholds are returned. Invalid matches are marked as NA.

Details

This function computes a matching between trees in a 3D space, where Z is not an actual height but a synthetic dimension created from DBH (or tree height). The goal is to improve discrimination between nearby trees of different sizes. Because DBH and spatial coordinates (XY) are not directly comparable, the Z dimension is scaled using the zrel parameter.

Matching is performed solving LSAP using Hungarian algorithm via solve_LSAP, which finds the lowest-cost one-to-one pairings. However, LSAP matches all items by default, even when no good match exists. To avoid poor assignments, dummy trees are introduced in the cost matrix with a fixed cost (unmatch_cost).

' If the cost of a match exceeds unmatch_cost, the algorithm prefers leaving the tree unmatched. These unmatched entries are then returned with index_inventory = NA.

Choosing a good value for unmatch_cost is important:

  • It must be higher than the cost of a good match, to allow valid pairings.

  • It must be lower than the cost of a bad match, to avoid forced poor pairings.

When unmatch_cost = "auto", a simple heuristic is used to estimate a reasonable value, which is printed to the console. Users can refine this value manually if needed.