\( \newcommand{\E}{\mathrm{E}} \) \( \newcommand{\A}{\mathrm{A}} \) \( \newcommand{\R}{\mathrm{R}} \) \( \newcommand{\N}{\mathrm{N}} \) \( \newcommand{\Q}{\mathrm{Q}} \) \( \newcommand{\Z}{\mathrm{Z}} \) \( \def\ccSum #1#2#3{ \sum_{#1}^{#2}{#3} } \def\ccProd #1#2#3{ \sum_{#1}^{#2}{#3} }\)
CGAL 4.11.3 - Point Set Processing
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages

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::make_las_point_reader (PointMap point_map)
 Generates a LAS property handler to read 3D points. More...
 
template<typename OutputIteratorValueType , typename OutputIterator , typename... PropertyHandler>
bool CGAL::read_las_points_with_properties (std::istream &stream, OutputIterator output, PropertyHandler &&...properties)
 Reads user-selected points properties from a .las or .laz stream. More...
 
template<typename OutputIteratorValueType , typename OutputIterator , typename PointPMap >
bool CGAL::read_las_points (std::istream &stream, OutputIterator output, PointPMap point_pmap)
 Reads points (position only) from a .las or .laz stream. More...
 
template<typename PointMap >
std::tuple< PointMap,
LAS_property::X,
LAS_property::Y,
LAS_property::Z > 
CGAL::make_las_point_writer (PointMap point_map)
 Generates a LAS property handler to write 3D points. More...
 
template<typename ForwardIterator , typename PointMap , typename... PropertyHandler>
bool CGAL::write_las_points_with_properties (std::ostream &stream, ForwardIterator first, ForwardIterator beyond, std::tuple< PointMap, LAS_property::X, LAS_property::Y, LAS_property::Z > point_property, PropertyHandler &&...properties)
 Saves the [first, beyond) range of points with properties to a .las stream. More...
 
template<typename ForwardIterator , typename PointMap >
bool CGAL::write_las_points (std::ostream &stream, ForwardIterator first, ForwardIterator beyond, PointMap point_map)
 Saves the [first, beyond) range of points (positions only) to a .las stream. More...
 

Function Documentation

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::make_las_point_reader ( PointMap  point_map)

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.

See Also
read_las_points_with_properties()
Template Parameters
PointMapthe property map used to store points.

#include <CGAL/IO/read_las_points.h>

Examples:
Point_set_processing_3/read_las_example.cpp.
template<typename PointMap >
std::tuple<PointMap, LAS_property::X, LAS_property::Y, LAS_property::Z > CGAL::make_las_point_writer ( PointMap  point_map)

Generates a LAS property handler to write 3D points.

See Also
write_las_points_with_properties()
Template Parameters
PointMapthe property map used to store points.

#include <CGAL/IO/write_las_points.h>

template<typename OutputIteratorValueType , typename OutputIterator , typename PointPMap >
bool CGAL::read_las_points ( std::istream &  stream,
OutputIterator  output,
PointPMap  point_pmap 
)

Reads points (position only) from a .las or .laz stream.

Potential additional properties are ignored.

Template Parameters
OutputIteratorValueTypetype of objects that can be put in OutputIterator. It is default to value_type_traits<OutputIterator>::type and can be omitted when the default is fine.
OutputIteratoriterator over output points.
PointPMapis a model of WritablePropertyMap with value_type CGAL::Point_3. It can be omitted if the value type of OutputIterator is convertible to CGAL::Point_3.
Returns
true on success.
Warning
This function requires a C++11 compiler.
Parameters
streaminput stream.
outputoutput iterator over points.
point_pmapproperty map: value_type of OutputIterator -> Point_3.

#include <CGAL/IO/read_las_points.h>

template<typename OutputIteratorValueType , typename OutputIterator , typename... PropertyHandler>
bool CGAL::read_las_points_with_properties ( std::istream &  stream,
OutputIterator  output,
PropertyHandler &&...  properties 
)

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 CGAL::cpp11::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
Warning
This function requires a C++11 compiler.
See Also
make_las_point_reader()
Template Parameters
OutputIteratorValueTypetype of objects that can be put in OutputIterator. It is default to value_type_traits<OutputIterator>::type and can be omitted when the default is fine.
OutputIteratoriterator over output points.
PropertyHandlerhandlers to recover properties.
Returns
true on success.

#include <CGAL/IO/read_las_points.h>

Examples:
Point_set_processing_3/read_las_example.cpp.
template<typename ForwardIterator , typename PointMap >
bool CGAL::write_las_points ( std::ostream &  stream,
ForwardIterator  first,
ForwardIterator  beyond,
PointMap  point_map 
)

Saves the [first, beyond) range of points (positions only) to a .las stream.

Template Parameters
ForwardIteratoriterator over input points.
PointMapis a model of ReadablePropertyMap with a value_type = Point_3<Kernel>. It can be omitted if the value type of ForwardIterator is convertible to Point_3<Kernel>.
Returns
true on success.
Warning
This function requires a C++11 compiler.
Parameters
streamoutput stream.
firstfirst input point.
beyondpast-the-end input point.
point_mapproperty map: value_type of OutputIterator -> Point_3.

#include <CGAL/IO/write_las_points.h>

template<typename ForwardIterator , typename PointMap , typename... PropertyHandler>
bool CGAL::write_las_points_with_properties ( std::ostream &  stream,
ForwardIterator  first,
ForwardIterator  beyond,
std::tuple< PointMap, LAS_property::X, LAS_property::Y, LAS_property::Z >  point_property,
PropertyHandler &&...  properties 
)

Saves the [first, beyond) 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 vairable as an int LAS property). An exception is used for points that are written using a std::tuple object.

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

See Also
make_las_point_writer()
Warning
This function requires a C++11 compiler.
Template Parameters
ForwardIteratoriterator over input points.
PointMapis a model of ReadablePropertyMap with a value_type = CGAL::Point_3.
PropertyHandlerhandlers to recover properties.
Returns
true on success.
Parameters
streamoutput stream.
firstiterator over the first input point.
beyondpast-the-end iterator over the input points.
point_propertyproperty handler for points
propertiesparameter pack of property handlers

#include <CGAL/IO/write_las_points.h>