match_trees.Rd
Applies a tree matching algorithm to a `TreeMapMatching` object and stores the result in the `match_table` field.
match_trees(treemap, method = lsap_matching, ...)
A `TreeMapMatching` object created with make_mapmatching
.
A function that performs the matching. It must accept a `TreeMapMatching` object
as its first argument and return a match table (typically a `data.table`).
Defaults to lsap_matching
and is the recommended method.
Additional arguments passed to the matching method.
A `TreeMapMatching` object, identical to the input but with an added
match_table
field containing the matching results.
This function provides a flexible interface for applying different tree matching algorithms. By default, it uses a 2 nearest-neighbors 3D matching function, but custom methods can be supplied. The result is returned as an enriched `TreeMapMatching` object, ready for further analysis or plotting.
data(PRF025_Field)
PRF025_Field <- standardize(
PRF025_Field,
xname = "Field_Xpj",
yname = "Field_Ypj",
zname = "DBH",
zunits = "cm",
crs = 2959)
center = c(PRF025_Field$Easting[1], PRF025_Field$Northing[1])
data(PRF025_Lidar)
PRF025_Lidar <- standardize(
PRF025_Lidar,
xname = "X",
yname = "Y",
zname = "DBH",
zunits = "m",
crs = 2959)
treemap = make_mapmatching(PRF025_Field, PRF025_Lidar, center, 11.28)
plot(treemap, scale = 2)
treemap = match_trees(treemap, method = lsap_matching, dxymax = 2, dzmax = 30)
#> unmatch_cost = 1.53
plot(treemap, scale = 2)
plot(treemap, rgl = TRUE)
#> Warning: RGL: unable to open X11 display
#> Warning: 'rgl.init' failed, will use the null device.
#> See '?rgl.useNULL' for ways to avoid this warning.
treemap$match_table
#> index_inventory index_measure cost state
#> 1 1 72 0.5659616 Matched
#> 2 2 81 0.4238956 Matched
#> 3 3 88 0.6373774 Matched
#> 4 4 90 0.5448624 Matched
#> 5 5 NA NA Omission
#> 6 6 54 0.4050463 Matched
#> 7 7 61 0.2338536 Matched
#> 8 8 62 0.5303301 Matched
#> 9 9 75 0.5448624 Matched
#> 10 10 68 0.3644345 Matched
#> 11 11 79 0.5659616 Matched
#> 12 12 60 0.5994789 Matched
#> 13 13 49 0.5303301 Matched
#> 14 14 34 0.8705243 Matched
#> 15 15 42 0.6312191 Matched
#> 16 16 20 0.8338540 Matched
#> 17 17 11 0.7551904 Matched
#> 18 18 27 0.7705518 Matched
#> 19 19 NA NA Omission
#> 20 20 26 0.7905694 Matched
#> 21 21 39 0.8794530 Matched
#> 22 22 14 0.7954951 Matched
#> 23 23 13 0.7806247 Matched
#> 24 24 9 1.0345591 Matched
#> 25 25 7 0.7705518 Matched
#> 26 26 6 0.8244316 Matched
#> 27 27 28 0.7447735 Matched
#> 28 28 16 0.8838835 Matched
#> 29 29 32 0.7180703 Matched
#> 30 30 19 0.9057110 Matched
#> 31 31 21 0.8003905 Matched
#> 32 32 17 0.7126096 Matched
#> 33 33 22 0.6731456 Matched
#> 34 34 46 0.7288690 Matched
#> 35 35 35 0.8338540 Matched
#> 36 36 40 0.8291562 Matched
#> 37 37 45 0.8100926 Matched
#> 38 38 44 0.7342088 Matched
#> 39 39 47 0.7905694 Matched
#> 40 40 66 1.0155048 Matched
#> 41 41 65 0.9842510 Matched
#> 42 42 69 0.9560662 Matched
#> 43 43 78 0.7126096 Matched
#> 44 44 59 0.7654655 Matched
#> 45 45 91 1.0345591 Matched
#> 46 46 85 0.5994789 Matched
#> 47 47 74 0.6434769 Matched
#> 48 48 92 0.7288690 Matched
#> 49 49 NA NA Omission
#> 50 50 80 0.4050463 Matched
#> 51 51 55 0.4592793 Matched
#> 52 52 56 0.8660254 Matched
#> 53 53 NA NA Omission
#> 54 54 48 0.3852759 Matched
#> 55 55 33 0.7500000 Matched
#> 56 56 12 0.9560662 Matched
#> 57 57 25 0.7071068 Matched
#> 58 58 53 0.8338540 Matched
#> 59 59 38 0.8196798 Matched
#> 60 60 NA NA Omission
#> 61 61 67 0.5659616 Matched
#> 62 62 58 0.5077524 Matched
#> 66 NA 4 NA Commission
#> 68 NA 8 NA Commission
#> 69 NA 10 NA Commission
#> 71 NA 18 NA Commission
#> 74 NA 29 NA Commission
#> 78 NA 37 NA Commission
#> 79 NA 41 NA Commission
#> 80 NA 43 NA Commission
#> 82 NA 51 NA Commission
#> 85 NA 63 NA Commission
#> 91 NA 77 NA Commission
#> 92 NA 82 NA Commission
#> 94 NA 84 NA Commission
#> 95 NA 86 NA Commission
#> 96 NA 87 NA Commission
#> 97 NA 89 NA Commission