Expand description
Read las points.
If you’re reading any significant number of points, you’ll want to make sure you’re using a
BufRead instead of just a Read:
use std::fs::File;
use std::io::BufReader;
use las::Reader;
let read = BufReader::new(File::open("tests/data/autzen.las").unwrap());
let reader = Reader::new(read).unwrap();Reader::from_path does this for you:
use las::Reader;
let reader = Reader::from_path("tests/data/autzen.las").unwrap();Ccompressed files are supported when using the feature “laz”:
use las::Reader;
if cfg!(feature = "laz") {
assert!(Reader::from_path("tests/data/autzen.laz").is_ok());
} else {
assert!(Reader::from_path("tests/data/autzen.laz").is_err());
}
Use Reader::read to read one point, and Reader::points to get an iterator over
Result<Point>:
use las::{Read, Reader};
let mut reader = Reader::from_path("tests/data/autzen.las").unwrap();
let first_point = reader.read().unwrap().unwrap();
let the_rest = reader.points().map(|r| r.unwrap()).collect::<Vec<_>>();Structs§
- An iterator over of the points in a
Reader. - Reads LAS data.
Enums§
- Error while reading.
Traits§
- A trait for objects which read LAS data.