A utility to convert E57 point cloud files to LAS format. It is based on the E57 crate and the LAS crate.
e57-to-las is an open-source tool designed to convert point cloud files in the E57 format to the LAS format. The conversion retains all the relevant point data and associated metadata, making it easier for users to work with point cloud data in environments that primarily support LAS. We use it to convert E57 files to LAS for use in Potree for web-based point cloud visualization.
- Parallel processing using
rayonfor faster conversion. - Streaming conversion: points are written as they are decoded, so memory use stays roughly constant regardless of the number of points.
- Errors are reported with context and stop the conversion. A failed conversion leaves no partial LAS file behind (with
--stations, point clouds already converted stay). Points with invalid coordinates are skipped. The command-line tool prints how many were skipped; library callers read the count fromSummary. - Optional pointclouds splitting in distinct LAS files and generation of station file (
stations.json), containing spatial coordinates of station points. This is activated by adding the--stationsflag, and the station points are calculated based on the transformation translations of the point clouds.
Install the command-line tool with cargo install e57-to-las, then run:
e57-to-las [OPTIONS] --path <PATH>To get changes that are not yet released on crates.io, install from the repository instead: cargo install --git https://github.com/nivalis-studio/e57-to-las.
For example:
e57-to-las --path scan.e57 --output out/ --stations --las-version 1.2-p, --path <PATH>: The path to the input E57 file.-o, --output <OUTPUT>: The output directory for the converted LAS files (default:./).-T, --threads <THREADS>: Number of threads for parallel processing (default: 0 = max possible).-S, --stations: Write each point cloud (station) to its own LAS file and generatestations.json. Off by default.-L, --las-version <LAS_VERSION>: Version of LAS format used for the output files, from1.0to1.4(default:1.4). LAS 1.0 and 1.1 cannot store colors: converting a colored scan with these versions fails with an error, so use1.2or newer.-h, --help: Print help.-V, --version: Print version.
- Without
--stations, all point clouds are merged into<output>/las/0.las. The point clouds are decoded in parallel, so their points can be interleaved in the file and the order can differ between runs; the set of points is always the same. Use--threads 1to keep the points in point cloud order. - With
--stations, each point cloud is written to<output>/las/<index>.las, and<output>/stations.jsonmaps each index to thex/y/ztranslation of that scan. - Coordinates are stored with 1 mm precision. A coarser precision is only used when the points span more than about 2,147 km.
- The tool prints how many points were written, the path of each file it wrote, and, when some points had invalid coordinates, how many were skipped.
To use this as a crate in your own project, add it to your Cargo.toml:
cargo add e57-to-lasYou can then use it in your code as follows:
use e57_to_las::{LasVersion, Options, convert};
fn main() -> e57_to_las::Result<()> {
let options = Options {
las_version: LasVersion::new(1, 4)?, // 1.0 to 1.4
threads: 0, // 0 = one worker per logical CPU
stations: true,
};
let summary = convert("path/to/input.e57", "path/to/output/directory", &options)?;
println!(
"Wrote {} points ({} skipped)",
summary.points_written, summary.points_skipped
);
Ok(())
}The cli feature (on by default) builds the e57-to-las binary and pulls in clap. Disable default features to depend on the library without it:
e57-to-las = { version = "0.9.0", default-features = false }If you'd like to contribute to the development of this tool, please create an issue or pull request on our GitHub repository. All contributions are welcome!
Here are some of the main dependencies used:
rayon: Parallelismclap: Command-line argument parsing (optionalclifeature, enabled by default)e57: E57 file format readerlas: LAS file format writeruuid: For GUID processingserde: For serialization and deserialization of data
Open-source MIT. See LICENSE for details.