Skip to content

oyhj1801/copc-rs

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

copc-rs

crates.io version docs.rs docs

copc-rs is a rust library for reading and writing Cloud Optimized Point Cloud (COPC) data.

Usage examples

reader

use copc_rs::{Bounds, BoundsSelection, CopcReader, LodSelection, Vector};

fn main() {
    let mut copc_reader = CopcReader::from_path("./lidar.copc.laz").unwrap();

    let bounds = Bounds {
        min: Vector {
            x: 698_100.,
            y: 6_508_100.,
            z: 0.,
        },
        max: Vector {
            x: 698_230.,
            y: 6_508_189.,
            z: 2_000.,
        },
    };

    for point in copc_reader
        .points(LodSelection::Resolution(1.), BoundsSelection::Within(bounds))
        .unwrap()
    {
        // do something with the points
    }
}

writer

use copc_rs::CopcWriter;
use las::Reader;

fn main() {
    let mut las_reader = Reader::from_path("./lidar.las").unwrap();

    let header = las_reader.header().clone();
    let num_points = header.number_of_points() as i32;

    let mut copc_writer = CopcWriter::from_path("./lidar.copc.laz", header, -1, -1).unwrap();

    let points = las_reader.points().filter_map(las::Result::ok);

    copc_writer.write(points, num_points).unwrap();

    println!("{:#?}", copc_writer.copc_info());
}

Credits

This library depends heavily on the work of Thomas Montaigu (@tmontaigu) and Pete Gadomski (@gadomski), the authors of the laz and las crates.

Releases

No releases published

Packages

No packages published

Languages

  • Rust 100.0%