pointtree.io

Tools for reading and writing point cloud files.

class pointtree.io.BasePointCloudReader[source]

Bases: ABC

Abstract base class for implementing point cloud file readers.

read(
file_path: str,
columns: List[str] | None = None,
) PointCloudIoData[source]

Reads a point cloud file.

Parameters:
  • file_path – Path of the point cloud file to be read.

  • columns – Name of the point cloud columns to be read. The x, y, and z columns are always read.

Returns:

Point cloud object.

Raises:

ValueError – If the point cloud format is not supported by the reader.

abstract supported_file_formats() List[str][source]
Returns:

File formats supported by the point cloud file reader.

class pointtree.io.BasePointCloudWriter[source]

Bases: ABC

Abstract base class for implementing point cloud file writers.

abstract supported_file_formats() List[str][source]
Returns:

File formats supported by the point cloud file writer.

write(
point_cloud: PointCloudIoData,
file_path: str,
columns: List[str] | None = None,
) None[source]

Writes a point cloud to a file.

Parameters:
  • point_cloud – Point cloud to be written.

  • file_path – Path of the output file.

  • columns – Point cloud columns to be written. The x, y, and z columns are always written.

Raises:

ValueError – If the point cloud format is not supported by the writer or if columns contains a column name that is not existing in the point cloud.

class pointtree.io.CsvReader[source]

Bases: BasePointCloudReader

Point cloud file reader for csv and txt files.

read(
file_path: str,
columns: List[str] | None = None,
) PointCloudIoData[source]

Reads a point cloud file.

Parameters:
  • file_path – Path of the point cloud file to be read.

  • columns – Name of the point cloud columns to be read. The x, y, and z columns are always read.

Returns:

Point cloud object.

Raises:

ValueError – If the point cloud format is not supported by the reader.

supported_file_formats() List[str][source]
Returns:

File formats supported by the point cloud file reader.

class pointtree.io.CsvWriter[source]

Bases: BasePointCloudWriter

Point cloud file writer for csv and txt files.

supported_file_formats() List[str][source]
Returns:

File formats supported by the point cloud file writer.

write(
point_cloud: PointCloudIoData,
file_path: str,
columns: List[str] | None = None,
) None[source]

Writes a point cloud to a file.

Parameters:
  • point_cloud – Point cloud to be written.

  • file_path – Path of the output file.

  • columns – Point cloud columns to be written. The x, y, and z columns are always written.

Raises:

ValueError – If the point cloud format is not supported by the writer or if columns contains a column name that is not existing in the point cloud.

class pointtree.io.LasReader(ignore_default_columns: bool = True)[source]

Bases: BasePointCloudReader

Point cloud file reader for las and laz files.

read(
file_path: str,
columns: List[str] | None = None,
) PointCloudIoData[source]

Reads a point cloud file.

Parameters:
  • file_path – Path of the point cloud file to be read.

  • columns – Name of the point cloud columns to be read. The x, y, and z columns are always read.

Returns:

Point cloud object.

Raises:

ValueError – If the point cloud format is not supported by the reader.

supported_file_formats() List[str][source]
Returns:

File formats supported by the point cloud file reader.

class pointtree.io.LasWriter(maximum_resolution: float = 1e-06)[source]

Bases: BasePointCloudWriter

Point cloud file writer for las and laz files.

Parameters:

maximum_resolution – Maximum resolution of point coordinates in meter. Corresponds to the scale parameter used in the las/laz compression. Larger values result in a stronger compression and lower point cloud resolution. Defaults to \(10^{-6}\) m.

Variables:

maximum_resolution – Maximum resolution of point coordinates in meter.

supported_file_formats() List[str][source]
Returns:

File formats supported by the point cloud file writer.

write(
point_cloud: PointCloudIoData,
file_path: str,
columns: List[str] | None = None,
) None[source]

Writes a point cloud to a file.

Parameters:
  • point_cloud – Point cloud to be written.

  • file_path – Path of the output file.

  • columns – Point cloud columns to be written. The x, y, and z columns are always written.

Raises:

ValueError – If the point cloud format is not supported by the writer or if columns contains a column name that is not existing in the point cloud.

class pointtree.io.PointCloudIoData(
data: DataFrame,
identifier: str | None = None,
x_max_resolution: float | None = None,
y_max_resolution: float | None = None,
z_max_resolution: float | None = None,
)[source]

Bases: object

Point cloud data structure used .

data: DataFrame
identifier: str | None = None
x_max_resolution: float | None = None
y_max_resolution: float | None = None
z_max_resolution: float | None = None
class pointtree.io.PointCloudReader[source]

Bases: object

Point cloud file reader for csv, las, laz, and txt files.

read(
file_path: str,
columns: List[str] | None = None,
) PointCloudIoData[source]

Reads a point cloud file.

Parameters:
  • file_path – Path of the point cloud file to be read.

  • columns – Name of the point cloud columns to be read. The x, y, and z columns are always read.

Returns:

Point cloud object.

Raises:

ValueError – If the point cloud format is not supported by the reader.

supported_file_formats() List[str][source]
Returns:

File formats supported by the point cloud file reader.

class pointtree.io.PointCloudWriter[source]

Bases: object

Point cloud file writer for csv, las, laz, and txt files.

supported_file_formats() List[str][source]
Returns:

File formats supported by the point cloud file writer.

write(
point_cloud: PointCloudIoData,
file_path: str,
columns: List[str] | None = None,
) None[source]

Writes a point cloud to a file.

Parameters:
  • point_cloud – Point cloud to be written.

  • file_path – Path of the output file.

  • columns – Point cloud columns to be written. The x, y, and z columns are always written.

Raises:

ValueError – If the point cloud format is not supported by the writer or if columns contains a column name that is not existing in the point cloud.