Module las::header[][src]

A Header describes the configuration and properties of las data.

Reading

A Reader uses a Header to expose metadata:

use las::{Read, Reader};
let reader = Reader::from_path("tests/data/autzen.las").unwrap();
let header = reader.header();
println!("The file has {} points.", header.number_of_points());

Writing

A Writer uses a header to configure how it will write points. To create a las file, you can use a Header from another file, use the default Header, or create one with a Builder:

use std::io::Cursor;
use las::{Write, Writer, Builder, Read, Reader, Header};

// Copy the configuration from an existing file.
let header = Reader::from_path("tests/data/autzen.las").unwrap().header().clone();
let writer = Writer::new(Cursor::new(Vec::new()), header).unwrap();

// Use the default configuration, which writes to a `Cursor<Vec<u8>>`.
let writer = Writer::default();

// Set your own configuration with a `Builder`.
let mut builder = Builder::from((1, 4));
builder.system_identifier = "Synthetic points".to_string();
let header = builder.into_header().unwrap();
let writer = Writer::new(Cursor::new(Vec::new()), header).unwrap();

Into raw bytes

A Header has a method to turn it into a raw::Header, which maps directly onto the bytes of the las spec:

use las::Header;
let header = Header::default();
let raw_header = header.into_raw().unwrap();
assert_eq!(b"LASF", &raw_header.file_signature);

Structs

Builder

Builds headers.

Header

Metadata describing the layout, source, and interpretation of the points.

Vlrs

An iterator over a header's variable length records.

Enums

Error

Header-specific errors.