Function pasture_io::las::las_point_format_from_point_layout[][src]

pub fn las_point_format_from_point_layout(point_layout: &PointLayout) -> Format

Returns the best matching LAS point format for the given PointLayout. This method tries to match as many attributes as possible in the given PointLayout to attributes that are supported by the LAS format (v1.4) natively. Attributes that do not have a corresponding LAS attribute are ignored. If no matching attributes are found, LAS point format 0 is returned, as it is the most basic format.


let layout_a = PointLayout::from_attributes(&[attributes::POSITION_3D]);
let las_format_a = las_point_format_from_point_layout(&layout_a);
assert_eq!(las_format_a, las::point::Format::new(0).unwrap());

let layout_b = PointLayout::from_attributes(&[attributes::POSITION_3D, attributes::GPS_TIME]);
let las_format_b = las_point_format_from_point_layout(&layout_b);
assert_eq!(las_format_b, las::point::Format::new(1).unwrap());