TreeCombine is a tool for merging multiple tree files into a single file. It can combine files by concatenating trees or by merging attributes from files with identical tree structures.
treecombine <tree_file1> <tree_file2> <tree_file3> ...
- Takes two or more tree files as input
- Automatically determines the appropriate combination method
The tool automatically selects one of two combination approaches:
When all files have the same attribute structure:
- Combines all trees from all files into a single file
- Preserves individual tree structures
- Maintains consistent attribute sets
When all files have identical tree structures but different attributes:
- Combines attribute sets from all files
- Maintains the same tree topology
- Creates comprehensive attribute datasets
- All input files must have identical attribute names
- Both segment attributes and tree-level attributes must match
- Trees can have different structures and counts
- All input files must have identical tree structures:
- Same number of trees
- Same number of segments per tree
- Same parent-child relationships (topology)
- Files can have different attribute sets
Combine separate forest surveys with same attributes:
treecombine plot1.txt plot2.txt plot3.txt
Combine files with same trees but different measurements:
treecombine base_structure.txt diameter_data.txt height_data.txt
Merge different time periods with same tree structure:
treecombine trees_2020.txt trees_2021.txt trees_2022.txt
The tool performs extensive validation:
- Checks tree count consistency
- Verifies segment count per tree
- Validates parent-child relationships
- Ensures topological consistency
- Compares attribute name lists
- Verifies tree-level attribute consistency
- Checks segment-level attribute matching
The tool will refuse to combine files when:
- Files have different attributes AND different tree structures
- Files have identical attributes AND identical tree structures (no benefit)
- Skips files that cannot be loaded
- Reports which files are being skipped
- Continues processing with remaining valid files
Creates a combined tree file containing:
- All trees from input files (concatenation mode)
- OR original tree structure with merged attributes (attribute mode)
- Comments from the first input file
- Consistent formatting and structure
- Combine multiple survey plots
- Merge field measurements with remote sensing data
- Integrate different measurement campaigns
- Combine multi-temporal datasets
- Merge growth measurements over time
- Create comprehensive forest monitoring datasets
- Combine structural data with biological attributes
- Merge LiDAR-derived and field-measured parameters
- Integrate different data collection methods
- Combine data from different sensors
- Merge manual and automated measurements
- Create comprehensive tree databases
treecombine forest_plot_A.txt forest_plot_B.txt forest_plot_C.txt
Combines trees from different plots into single forest file.
treecombine structure.txt biomass.txt health.txt
Adds biomass and health attributes to existing tree structure.
treecombine baseline.txt growth_year1.txt growth_year2.txt
Creates time-series dataset with growth measurements.
The tool ensures:
- No data loss during combination
- Preservation of tree topology
- Consistent attribute formatting
- Proper error reporting for incompatible files
- Comments are preserved from the first input file only
- File processing order affects the final attribute order
- Large datasets are handled efficiently with minimal memory usage
- For more detailed information on combination algorithms, refer to the
TreeCombinesource code attreetools/treetools/treecombine/treecombine.cpp.