API Reference Python

The roofer python API allows you to use the roofer library from Python. Most notably it provides a reconstruct() function that takes a pointcloud and a roofprint polygon for a single building object and returns a reconstructed building model mesh.

Note

Because roofer internally uses floats to represent coordinates, it is advised to translate your data to the origin prior to calling reconstruct() to prevent loss of precision.

See this script for a simple example of how to use the Python bindings.

The API uses plain Python sequences for geometry:

  • Point: three numbers, [x, y, z]

  • PointCloud: a sequence of Point

  • Ring: a sequence of Point

  • Footprint: a sequence of rings, where the first ring is the exterior ring and subsequent rings are holes

  • Mesh: a sequence of polygons, where each polygon is a sequence of rings

roofer.reconstruct(points_roof, points_ground, footprint, cfg=ReconstructionConfig())
roofer.reconstruct(points_roof, footprint, cfg=ReconstructionConfig())

Reconstruct a single building.

The first overload uses both roof and ground points. The second overload reconstructs without ground points.

Parameters:
  • points_roof – Building or roof points as a PointCloud.

  • points_ground – Ground points as a PointCloud.

  • footprint – Building footprint as a Footprint.

  • cfg (ReconstructionConfig) – Reconstruction parameters.

Returns:

Reconstructed meshes.

Return type:

list[Mesh]

roofer.triangulate_mesh(mesh)

Triangulate a mesh.

Parameters:

mesh (Mesh) – Mesh to triangulate.

Returns:

A tuple (vertices, faces), where vertices is a list of points and faces is a list of three vertex indices.

Return type:

tuple[list[Point], list[list[int]]]

class roofer.ReconstructionConfig
property clip_ground
property complexity_factor
property floor_elevation
is_valid(self: roofer.ReconstructionConfig) bool
property line_detect_epsilon
property lod
property lod13_step_height
property override_with_floor_elevation
property plane_detect_epsilon
property plane_detect_k
property plane_detect_min_points
property plane_detect_normal_angle
property thres_alpha
property thres_reg_line_dist
property thres_reg_line_ext