pub trait Read {
// Required methods
fn header(&self) -> &Header;
fn read(&mut self) -> Option<Result<Point>>;
fn read_n(&mut self, n: u64) -> Result<Vec<Point>>;
fn read_n_into(&mut self, n: u64, points: &mut Vec<Point>) -> Result<u64>;
fn read_all_points(&mut self, points: &mut Vec<Point>) -> Result<u64>;
fn seek(&mut self, position: u64) -> Result<()>;
fn points(&mut self) -> PointIterator<'_> ⓘ;
}
Expand description
A trait for objects which read LAS data.
Required Methods§
sourcefn header(&self) -> &Header
fn header(&self) -> &Header
Returns a reference to this reader’s header.
§Examples
use las::{Read, Reader};
let reader = Reader::from_path("tests/data/autzen.las").unwrap();
let header = reader.header();
sourcefn read(&mut self) -> Option<Result<Point>>
fn read(&mut self) -> Option<Result<Point>>
Reads a point.
§Examples
let mut reader = Reader::from_path("tests/data/autzen.las").unwrap();
let point = reader.read().unwrap().unwrap();
sourcefn read_n_into(&mut self, n: u64, points: &mut Vec<Point>) -> Result<u64>
fn read_n_into(&mut self, n: u64, points: &mut Vec<Point>) -> Result<u64>
Reads n points into the vec
sourcefn read_all_points(&mut self, points: &mut Vec<Point>) -> Result<u64>
fn read_all_points(&mut self, points: &mut Vec<Point>) -> Result<u64>
Reads all points left into the vec
sourcefn seek(&mut self, position: u64) -> Result<()>
fn seek(&mut self, position: u64) -> Result<()>
Seeks to the given point number, zero-indexed.
Note that seeking on compressed (LAZ) data can be expensive as the reader will have to seek to the closest chunk start and decompress all points up until the point seeked to.
§Examples
use las::{Read, Reader};
let mut reader = Reader::from_path("tests/data/autzen.las").unwrap();
reader.seek(1).unwrap(); // <- seeks to the second point
let the_second_point = reader.read().unwrap().unwrap();
sourcefn points(&mut self) -> PointIterator<'_> ⓘ
fn points(&mut self) -> PointIterator<'_> ⓘ
Returns an iterator over this reader’s points.
§Examples
let mut reader = Reader::from_path("tests/data/autzen.las").unwrap();
let points = reader.points().collect::<Result<Vec<_>, _>>().unwrap();