pub struct CopcWriter<'a, W: 'a + Write + Seek> { /* private fields */ }Expand description
COPC file writer
Implementations§
Source§impl CopcWriter<'_, BufWriter<File>>
impl CopcWriter<'_, BufWriter<File>>
Source§impl<W: Write + Seek> CopcWriter<'_, W>
public API
impl<W: Write + Seek> CopcWriter<'_, W>
public API
Sourcepub fn new(
write: W,
header: Header,
min_size: i32,
max_size: i32,
) -> Result<Self>
pub fn new( write: W, header: Header, min_size: i32, max_size: i32, ) -> Result<Self>
Create a COPC file writer for the write- and seekable write
configured with the provided las::Header
recommended to use from_path for writing to file
The bounds field in the header is used as the bounds for the octree
the bounds are checked for being normal
max_size is the maximal number of las::Points an octree node can hold
any max_size < 1 sets the max_size to [crate::MAX_NODE_SIZE_DEFAULT]
this is a soft limit
min_size is the minimal number of las::Points an octree node can hold
any min_size < 1 sets the min_size to [crate::MIN_NODE_SIZE_DEFAULT]
this is a hard limit
min_size greater or equal to max_size after checking values < 1
results in a crate::Error::InvalidNodeSize error
This writer is strictly following the LAS 1.4 spec and the COPC spec which means that any provided header not compatible with those will lead to an Err That being said, LAS 1.2 headers and PDRFs 1 and 3 are accepted and upgraded to their matching LAS 1.4 versions GeoTiff CRS VLR’s are parsed and written to WKT CRS VLR’s A CRS VLR is MANDATORY and without one
Sourcepub fn write<D: IntoIterator<Item = Point>>(
&mut self,
data: D,
num_points: i32,
) -> Result<()>
pub fn write<D: IntoIterator<Item = Point>>( &mut self, data: D, num_points: i32, ) -> Result<()>
Write anything that implements IntoIterator over las::Point to the COPC Write Only one iterator can be written so a call to Self::write closes the writer.
num_points is the number of points in the iterator
the number of points is used for stochastically filling the nodes
if num_points is < 1 a greedy filling strategy is used
this should only be used if the passed iterator is randomly ordered
which most of the time not is the case
if num_points is not equal to the actual number of points in the
iterator all points will still be written but the point distribution
in a node will not represent of the entire distribution over that node
i.e. only full resolution queries will look right which means the point cloud
will look wierd in any viewer which utilizes the COPC information
returns an Err(crate::Error::ClosedWriter) if the writer has already been closed.
If a point is outside the copc bounds or not matching the
las::point::Format of the writer’s header Err is returned
crate::PointAddError::PointAttributesDoNotMatch take precedence over
crate::PointAddError::PointNotInBounds
All the points inside the bounds and matching the point format are written regardless
All points which both match the point format and are inside the bounds are added
Lastly Self::close is called. If closing fails an crate::Error is returned and the state of the Write is undefined
If all points match the format, are inside the bounds and Self::close is successfull Ok(()) is returned
Sourcepub fn max_node_size(&self) -> i32
pub fn max_node_size(&self) -> i32
number of points in the largest node
Sourcepub fn min_node_size(&self) -> i32
pub fn min_node_size(&self) -> i32
number of points in the smallest node
Sourcepub fn header(&self) -> &Header
pub fn header(&self) -> &Header
This writer’s header, some fields are updated on closing of the writer
Sourcepub fn hierarchy_entries(&self) -> &HierarchyPage
pub fn hierarchy_entries(&self) -> &HierarchyPage
This writer’s EPT Hierarchy