# copc-rust
[](https://crates.io/crates/copc-core)
[](https://docs.rs/copc-core)
[](https://crates.io/crates/copc-reader)
[](https://docs.rs/copc-reader)
[](https://crates.io/crates/copc-writer)
[](https://docs.rs/copc-writer)
Pure-Rust COPC reader, writer, and shared core primitives for cloud-optimized
point clouds. No C libraries, no build scripts; internal unsafe is limited to
read-only memory mapping of writer spill files.
## Crates
| `copc-core` | Shared COPC metadata, hierarchy entries, voxel keys, bounds, streaming LAS records, and errors |
| `copc-reader` | COPC header/info parsing, recursive hierarchy access, and chunked-LAZ point iteration |
| `copc-writer` | COPC writer with source-trait point access, native LOD distribution, mmap spill support, and streaming LAS/LAZ intake |
## Usage
```rust
use copc_reader::CopcFile;
let file = CopcFile::open("cloud.copc.laz")?;
for entry in file.hierarchy_walk() {
println!("{:?} points={}", entry.key, entry.point_count);
}
```
```rust
use copc_reader::{BoundsSelection, CopcReader, LodSelection};
let mut reader = CopcReader::from_path("cloud.copc.laz")?;
for point in reader.points(LodSelection::All, BoundsSelection::All)? {
let point = point?;
println!("{},{},{}", point.x, point.y, point.z);
}
```
```rust
use copc_writer::{convert_las_to_copc_streaming, CopcWriterParams};
convert_las_to_copc_streaming(
"input.laz".as_ref(),
"output.copc.laz".as_ref(),
&CopcWriterParams::default(),
std::env::temp_dir().as_ref(),
&copc_core::NeverCancel,
)?;
```
## Supported Now
- Public COPC hierarchy types for availability, indexing, and tile serving
- COPC info VLR and recursive hierarchy page parsing
- Chunked-LAZ point iteration in `copc-reader`
- All-points, LOD-selected, and bounds-selected reader point iteration
- Source-trait writer API for caller-owned point storage
- Streaming LAS/LAZ-to-COPC conversion through a disk-backed mmap spill
- LAS 1.4 point formats 6 and 7 with LAZ variable-size chunks
- Interior-node representative points for native LOD reads
## Not Yet Supported
- Materialized point-column convenience APIs
## Testing
```sh
cargo fmt --all -- --check
cargo clippy --workspace --all-targets -- -D warnings
cargo test --workspace
```
Checked-in external COPC fixtures from PDAL and QGIS are exercised by:
```sh
cargo test -p copc-reader --test external_fixtures
```
## License
MIT OR Apache-2.0