CGAL 6.1 - Point Set Processing

Loading...
Searching...
No Matches
Functions
I/O (LAS Format)
Reference Manual

##

Read and write points (with or without additional properties) in LAS format.

## Functions
template<typename PointMap >
std::tuple< PointMap, typename Kernel_traits< typename PointMap::value_type >::Kernel::Construct_point_3, LAS_property::X, LAS_property::Y, LAS_property::Z > | CGAL::IO::make_las_point_reader (PointMap point_map)
| generates a LAS property handler to read 3D points.
template<typename OutputIteratorValueType , typename PointOutputIterator , typename ... PropertyHandler>
bool | CGAL::IO::read_LAS_with_properties (std::istream &is, PointOutputIterator output, PropertyHandler &&... properties)
| reads user-selected points properties from a .las or .laz stream.
template<typename OutputIteratorValueType , typename PointOutputIterator , typename NamedParameters = CGAL::parameters::Default_named_parameters>
bool | CGAL::IO::read_LAS (std::istream &is, PointOutputIterator output, const NamedParameters &np=parameters::default_values())
| reads points (position only) using the LAS (Lidar) File Format.
template<typename OutputIteratorValueType , typename PointOutputIterator , typename NamedParameters = CGAL::parameters::Default_named_parameters>
bool | CGAL::IO::read_LAS (const std::string &filename, PointOutputIterator output, const NamedParameters &np=parameters::default_values())
| reads points (position only) using the LAS (Lidar) File Format.
template<typename PointMap >
std::tuple< PointMap, LAS_property::X, LAS_property::Y, LAS_property::Z > | CGAL::IO::make_las_point_writer (PointMap point_map)
| generates a LAS property handler to write 3D points.
template<typename PointRange , typename PointMap , typename ... PropertyHandler>
bool | CGAL::IO::write_LAS_with_properties (std::ostream &os, const PointRange &points, std::tuple< PointMap, LAS_property::X, LAS_property::Y, LAS_property::Z > point_property, PropertyHandler &&... properties)
| writes the range of `points` with properties to a .las stream.
template<typename PointRange , typename NamedParameters = CGAL::parameters::Default_named_parameters>
bool | CGAL::IO::write_LAS (std::ostream &os, const PointRange &points, const NamedParameters &np=parameters::default_values())
| writes the range of `points` (positions only), using the LAS (Lidar) File Format.
template<typename PointRange , typename NamedParameters = CGAL::parameters::Default_named_parameters>
bool | CGAL::IO::write_LAS (const std::string &filename, const PointRange &points, const NamedParameters &np=parameters::default_values())
| writes the range of `points` (positions only), using the LAS (Lidar) File Format.

## Function Documentation

## ◆ make_las_point_reader()

template<typename PointMap >

std::tuple< PointMap, typename Kernel_traits< typename PointMap::value_type >::Kernel::Construct_point_3, LAS_property::X, LAS_property::Y, LAS_property::Z > CGAL::IO::make_las_point_reader | ( | PointMap | point_map | ) |

`#include <CGAL/IO/read_las_points.h>`

generates a LAS property handler to read 3D points.

Points are constructed from the input the using 3 LAS properties `LAS_property::X`, `LAS_property::Y` and `LAS_property::Z`.

Template Parameters

  PointMap | the property map used to store points.

See also
  `read_LAS_with_properties()`
  LAS (Lidar) File Format

Examples
  Point_set_processing_3/orient_scanlines_example.cpp, and Point_set_processing_3/read_las_example.cpp.

## ◆ make_las_point_writer()

template<typename PointMap >

std::tuple< PointMap, LAS_property::X, LAS_property::Y, LAS_property::Z > CGAL::IO::make_las_point_writer | ( | PointMap | point_map | ) |

`#include <CGAL/IO/write_las_points.h>`

generates a LAS property handler to write 3D points.

Template Parameters

  PointMap | the property map used to store points.

See also
  `write_LAS()`
  LAS (Lidar) File Format

## ◆ read_LAS() [1/2]

template<typename OutputIteratorValueType , typename PointOutputIterator , typename NamedParameters = CGAL::parameters::Default_named_parameters>

bool CGAL::IO::read_LAS | ( | const std::string & | filename,
|  | PointOutputIterator | output,
|  | const NamedParameters & | np = `parameters::default_values()`
| ) |  |

`#include <CGAL/IO/read_las_points.h>`

reads points (position only) using the LAS (Lidar) File Format.

Potential additional properties are ignored.

Template Parameters

  OutputIteratorValueType | type of objects that can be put in `PointOutputIterator`. It must be a model of `DefaultConstructible` and defaults to `value_type_traits<PointOutputIterator>::type`. It can be omitted when the default is fine.
  PointOutputIterator | iterator over output points.
  NamedParameters | a sequence of Named Parameters

Parameters

  filename | name of the input file
  output | output iterator over points
  np | an optional sequence of Named Parameters among the ones listed below

Optional Named Parameters

  a property map associating points to the elements of the point range Type: a model of `WritablePropertyMap` with value type `geom_traits::Point_3` Default: `CGAL::Identity_property_map<geom_traits::Point_3>` |
  an instance of a geometric traits class Type: a model of `Kernel` Default: a CGAL Kernel deduced from the point type, using `CGAL::Kernel_traits` |

Returns
  `true` if reading was successful, `false` otherwise.

See also
  `read_LAS_with_properties()`

## ◆ read_LAS() [2/2]

template<typename OutputIteratorValueType , typename PointOutputIterator , typename NamedParameters = CGAL::parameters::Default_named_parameters>

bool CGAL::IO::read_LAS | ( | std::istream & | is,
|  | PointOutputIterator | output,
|  | const NamedParameters & | np = `parameters::default_values()`
| ) |  |

`#include <CGAL/IO/read_las_points.h>`

reads points (position only) using the LAS (Lidar) File Format.

Potential additional properties are ignored.

Attention
  To read a binary file, the flag `std::ios::binary` must be set during the creation of the `ifstream`.

Template Parameters

  OutputIteratorValueType | type of objects that can be put in `PointOutputIterator`. It must be a model of `DefaultConstructible` and defaults to `value_type_traits<PointOutputIterator>::type`. It can be omitted when the default is fine.
  PointOutputIterator | iterator over output points.
  NamedParameters | a sequence of Named Parameters

Parameters

  is | input stream
  output | output iterator over points
  np | an optional sequence of Named Parameters among the ones listed below

Optional Named Parameters

  a property map associating points to the elements of the point range Type: a model of `WritablePropertyMap` with value type `geom_traits::Point_3` Default: `CGAL::Identity_property_map<geom_traits::Point_3>` |
  an instance of a geometric traits class Type: a model of `Kernel` Default: a CGAL Kernel deduced from the point type, using `CGAL::Kernel_traits` |

Returns
  `true` if reading was successful, `false` otherwise.

See also
  `read_LAS_with_properties()`

## ◆ read_LAS_with_properties()

template<typename OutputIteratorValueType , typename PointOutputIterator , typename ... PropertyHandler>

bool CGAL::IO::read_LAS_with_properties | ( | std::istream & | is,
|  | PointOutputIterator | output,
|  | PropertyHandler &&... | properties
| ) |  |

`#include <CGAL/IO/read_las_points.h>`

reads user-selected points properties from a .las or .laz stream.

Potential additional properties are ignored.

Properties are handled through a variadic list of property handlers. A `PropertyHandler` can either be:

- A `std::pair<PropertyMap, LAS_property::Tag >` if the user wants to read a LAS property as a scalar value `LAS_property::Tag::type` (for example, storing an `int` LAS property into an `int` variable).
- A `std::tuple<PropertyMap, Constructor, LAS_property::Tag...>` if the user wants to use one or several LAS properties to construct a complex object (for example, storing 4 `unsigned short` LAS properties into a Color object that can for example be a `std::array<unsigned short, 4>`). In that case, the second element of the tuple should be a functor that constructs the value type of `PropertyMap` from N objects of of type `LAS_property::Tag::type`.

The LAS standard defines a fixed set of properties accessible through the following tag classes:

- `LAS_property::X` with type `double`
- `LAS_property::Y` with type `double`
- `LAS_property::Z` with type `double`
- `LAS_property::Intensity` with type `unsigned short`
- `LAS_property::Return_number` with type `unsigned char`
- `LAS_property::Number_of_returns` with type `unsigned char`
- `LAS_property::Scan_direction_flag` with type `unsigned char`
- `LAS_property::Edge_of_flight_line` with type `unsigned char`
- `LAS_property::Classification` with type `unsigned char`
- `LAS_property::Synthetic_flag` with type `unsigned char`
- `LAS_property::Keypoint_flag` with type `unsigned char`
- `LAS_property::Withheld_flag` with type `unsigned char`
- `LAS_property::Scan_angle` with type `double`
- `LAS_property::User_data` with type `unsigned char`
- `LAS_property::Point_source_ID` with type `unsigned short`
- `LAS_property::Deleted_flag` with type `unsigned int`
- `LAS_property::GPS_time` with type `double`
- `LAS_property::R` with type `unsigned short`
- `LAS_property::G` with type `unsigned short`
- `LAS_property::B` with type `unsigned short`
- `LAS_property::I` with type `unsigned short`

Attention
  To read a binary file, the flag `std::ios::binary` must be set during the creation of the `ifstream`.

Template Parameters

  OutputIteratorValueType | type of objects that can be put in `PointOutputIterator`. It must be a model of `DefaultConstructible` and defaults to `value_type_traits<PointOutputIterator>::type`. It can be omitted if the default is fine.
  PointOutputIterator | iterator over output points.
  PropertyHandler | handlers to recover properties.

Returns
  `true` if reading was successful, `false` otherwise.

See also
  `make_las_point_reader()`
  LAS (Lidar) File Format

Examples
  Point_set_processing_3/orient_scanlines_example.cpp, and Point_set_processing_3/read_las_example.cpp.

## ◆ write_LAS() [1/2]

template<typename PointRange , typename NamedParameters = CGAL::parameters::Default_named_parameters>

bool CGAL::IO::write_LAS | ( | const std::string & | filename,
|  | const PointRange & | points,
|  | const NamedParameters & | np = `parameters::default_values()`
| ) |  |

`#include <CGAL/IO/write_las_points.h>`

writes the range of `points` (positions only), using the LAS (Lidar) File Format.

Template Parameters

  PointRange | is a model of `ConstRange`. The value type of its iterator is the key type of the named parameter `point_map`.
  NamedParameters | a sequence of Named Parameters

Parameters

  filename | the path the output file
  points | input point range
  np | an optional sequence of Named Parameters among the ones listed below

Optional Named Parameters

  a property map associating points to the elements of the point range Type: a model of `ReadablePropertyMap` with value type `geom_traits::Point_3` Default: `CGAL::Identity_property_map<geom_traits::Point_3>` |
  an instance of a geometric traits class Type: a model of `Kernel` Default: a CGAL Kernel deduced from the point type, using `CGAL::Kernel_traits` |

Returns
  `true` if writing was successful, `false` otherwise.

See also
  `write_LAS_with_properties()`

## ◆ write_LAS() [2/2]

template<typename PointRange , typename NamedParameters = CGAL::parameters::Default_named_parameters>

bool CGAL::IO::write_LAS | ( | std::ostream & | os,
|  | const PointRange & | points,
|  | const NamedParameters & | np = `parameters::default_values()`
| ) |  |

`#include <CGAL/IO/write_las_points.h>`

writes the range of `points` (positions only), using the LAS (Lidar) File Format.

Attention
  To write to a binary file, the flag `std::ios::binary` must be set during the creation of the `ofstream`.

Template Parameters

  PointRange | is a model of `ConstRange`. The value type of its iterator is the key type of the named parameter `point_map`.
  NamedParameters | a sequence of Named Parameters

Parameters

  os | output stream
  points | input point range
  np | an optional sequence of Named Parameters among the ones listed below

Optional Named Parameters

  a property map associating points to the elements of the point range Type: a model of `ReadablePropertyMap` with value type `geom_traits::Point_3` Default: `CGAL::Identity_property_map<geom_traits::Point_3>` |
  an instance of a geometric traits class Type: a model of `Kernel` Default: a CGAL Kernel deduced from the point type, using `CGAL::Kernel_traits` |

Returns
  `true` if writing was successful, `false` otherwise.

See also
  LAS (Lidar) File Format
  `write_LAS_with_properties()`

## ◆ write_LAS_with_properties()

template<typename PointRange , typename PointMap , typename ... PropertyHandler>

bool CGAL::IO::write_LAS_with_properties | ( | std::ostream & | os,
|  | const PointRange & | points,
|  | std::tuple< PointMap, LAS_property::X, LAS_property::Y, LAS_property::Z > | point_property,
|  | PropertyHandler &&... | properties
| ) |  |

`#include <CGAL/IO/write_las_points.h>`

writes the range of `points` with properties to a .las stream.

Properties are handled through a variadic list of property handlers. A `PropertyHandle` is a `std::pair<PropertyMap, LAS_property::Tag >` used to write a scalar value `LAS_property::Tag::type` as a LAS property (for example, writing an `int` variable as an `int` LAS property). An exception is used for points that are written using a `std::tuple` object.

See documentation of `read_LAS_with_properties()` for the list of available `LAS_property::Tag` classes.

Attention
  To write to a binary file, the flag `std::ios::binary` must be set during the creation of the `ofstream`.

Template Parameters

  PointRange | is a model of `ConstRange`. The value type of its iterator is the key type of the named parameter `point_map`.
  PointMap | is a model of `ReadablePropertyMap` with a value_type = `CGAL::Point_3`.
  PropertyHandler | handlers to recover properties.

Returns
  `true` if writing was successful, `false` otherwise.

See also
  `make_las_point_writer()`
  LAS (Lidar) File Format

Parameters

  os | output stream.
  points | input point range.
  point_property | property handler for points
  properties | parameter pack of property handlers