How mfbonfigli/gocesiumtiler works
Main Components
• CLI Driver: Represented by the “cmd” folder (with main.go/main_test.go) that sets up the entry point and parses CLI flags like “file” and “folder” commands.
• Core Tiling Engine: The “tiler” package is the orchestrator that pulls together file processing, spatial segmentation, mutator applications, and output tiling.
• LAS File Handling: Under “internal/las” there are modules for LAS reading (including test data), geometry extraction (points, intensity, classification) and CRS metadata.
• Coordinate Conversion: Found in “internal/conv” (with submodules for coordinate conversion in “coor” and “proj”) that handle the transformation of input points into the local and global coordinate systems.
• Output Writer Layer: The “internal/writer” package handles conversion into output formats (consumers/producers for Cesium 3D Tiles such as .pnts and glTF assets). This layer also uses the “share” folder for projection and grid data.
• Utilities and Helpers: “internal/utils” provide binary and IO functionalities required across the project.
• Versioning & Build Infrastructure: The “version” directory with version/version.go and build scripts (build.sh, build.ps1, Dockerfile) indicate CI/CD and environment reproducibility.
Data Flow
• The tiling engine initiates LAS file reading via the LAS module. Once LAS files are read, points are converted using the coordinate conversion module.
• The conversion results feed into the spatial data structures – the octree/grid implemented in the “internal/tree” – responsible for spatial sampling and level-of-detail generation.
• During point processing, optional “mutators” (e.g., ZOffset and Subsampler, as well as any custom mutators) are applied to modify or filter points.
• Finally, the processed data is handed off to the writer module that emits the final output in Cesium 3D Tiles formats.
• Support files in the “share” folder (such as grid definitions, Proj configuration files, etc.) are referenced during CRS conversion and output construction.
Architectural Patterns & Design Principles
• Modular Design: Packages are clearly separated; for instance, file reading, conversion, tree-based spatial manipulation, and tile writing are isolated.
• Plugin/Mutator Pattern: The tiler accepts implementations of the mutator interface, providing extensibility and customization of point processing.
• In-memory Data Processing: The design emphasizes speed by processing data entirely in memory (as highlighted in the README) and using efficient data structures (like a linked tree backed by an array).
• Clear CLI and Library Separation: The project is usable as both a stand-alone command-line tool and as a Go library, making the architecture flexible.
Technologies and External Dependencies
• Go language core and modules (go.mod, go.sum).
• Proj 9.5.0 (for coordinate conversion) and its grid data (located in the “share” folder).
• Utilization of goroutines (to process data concurrently) based on README notes regarding multi-core usage.