py3dtiles.tilers.point.point_tiler module#

class py3dtiles.tilers.point.point_tiler.PointTiler(crs_in: CRS | None = None, crs_out: CRS | None = None, force_crs_in: bool = False, pyproj_always_xy: bool = False, rgb: bool = True, color_scale: float | None = None, cache_size: int = 3210, verbosity: int = 0, number_of_jobs: int = 8, extra_fields: list[str] | None = None)[source]#

Bases: Tiler[PointSharedMetadata, PointTilerWorker]

Tiler that split pointclouds.

This tiler is able to reproject pointclouds, and can embed arbitrary fields in the resulting 3dtiles

Parameters:
  • crs_in – crs to use for files that don’t have crs informations in their metadata, or for all files if force_crs_in is used

  • crs_out – output crs

  • force_crs_in – whether or not to apply crs_in for all files.

  • pyproj_always_xy – some crs defines an axis order, but some dataset still use xy order nonetheless. This boolean allows to support this case.

  • rgb – whether to include rgb info or not

  • color_scale – scale the color in the case of colors wrongly encoded in 8 bit in a 16-bit field (like in las/laz files).

  • cache_size – the size in MB to use for ram cache.

  • verbosity – verbosity level

  • number_of_jobs – how many process this tiler is allowed to use

  • extra_fields – the list of extra fields to include in the resulting 3dtiles

benchmark(benchmark_id: str, startup: float) None[source]#

Prints benchmark info at the end of the conversion of this tiler and the writing of the tileset.

cache_size: int#
color_scale: float | None#
crs_in: CRS | None#
crs_out: CRS | None#
dispatch_processed_nodes(content: dict[str, bytes]) None[source]#
extra_fields_to_include: list[str]#
file_info: dict[str, Any]#
files_info: dict[str, Any]#
force_crs_in: bool#
get_files_info(crs_in: CRS | None, force_crs_in: bool = False) dict[str, Any][source]#
get_root_aabb(original_aabb: ndarray[Any, dtype[float64]]) tuple[ndarray[Any, dtype[float64]], ndarray[Any, dtype[float32]], float][source]#
get_rotation_matrix(crs_out: CRS | None, transformer: Transformer | None) tuple[ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]]][source]#
get_tasks() Generator[tuple[bytes, list[bytes]], None, None][source]#

Yields tasks to be sent to workers.

This methods will get called by the main convert function each time it wants new tasks to be fed to workers. Implementors should each time returns the task that has the biggest priority.

py3dtiles will iterate until the returned iterator is exhausted before continuing the process. It will call it as many times as needed during the execution. It is therefore not necessary to generate all the tasks in one go.

Once this function returns an empty list and all the workers are idle, the conversion process stops.

If generating the tasks is somewhat expensive, do return a Generator instead. Tasks will be sent to workers as soon as they are yielded.

get_tileset(use_process_pool: bool = True) TileSet[source]#

Get the tileset file once the binary data are written.

This function will be called once by convert after this tiler has stopped generating tasks and all the workers are idle.

Parameters:

use_process_pool – allow the use of a process pool. Process pools can cause issues in

environment lacking shared memory.

get_transformer() Transformer | None[source]#
get_worker() PointTilerWorker[source]#

Returns an instantiated tiler worker.

initialize(files: list[Path], working_dir: Path, out_folder: Path) None[source]#

This method will be called first by convert to initialize the conversion process. Tilers will receive all the paths informations as argument to this method. Only files supported by this tiler will be in the files argument. Tilers are expected to gather metadata from those input files so that subsequent call to get_tasks can generate some conversion work to do by workers.

This method is probably a good place to init the SharedMetadata subclass instance as well.

memory_control() None[source]#

Method called at the end of each loop of the convert method. Checks if there is no too much memory used by the tiler and do actions in function

name = b'points'#
node_store: SharedNodeStore#
number_of_jobs: int#
out_folder: Path#
print_summary() None[source]#

Prints the summary of the tiler before the start of the conversion.

process_message(message_type: bytes, result: list[bytes]) None[source]#

This method is called with each message sent by workers. Its role is to process those messages, to update the internal state of the tiler, so that new tasks or a tileset writing could proceed.

rgb: bool#
root_aabb: ndarray[Any, dtype[float64]]#
root_scale: ndarray[Any, dtype[float32]]#
root_spacing: float#
send_file_to_read() tuple[bytes, list[bytes]][source]#
send_pnts_to_write() tuple[bytes, list[bytes]][source]#
send_points_to_process() Generator[tuple[bytes, list[bytes]], None, None][source]#
shared_metadata: PointSharedMetadata#
state: PointState#
supports(file: Path) bool[source]#

This function tells the main process if this tiler supports this file or not.

The main process will use the first supporting tiler it finds for each file.

Implementation should not require to read the whole file to determine if this tiler supports it. In other word, the execution time should be a constant regardless of the file size.

transformer: Transformer | None#
validate() None[source]#

Checks if the state of the tiler or the binary data written is correct. This method is called after the end of the conversion of this tiler (but before writing the tileset). Overwrite this method if you wish to run some validation code for the generated tileset.

verbosity: int#
py3dtiles.tilers.point.point_tiler.can_pnts_be_written(node_name: bytes, finished_node: bytes, input_nodes: dict[bytes, Any], active_nodes: set[bytes]) bool[source]#
py3dtiles.tilers.point.point_tiler.is_ancestor(node_name: bytes, ancestor: bytes) bool[source]#

Example, the tile 22 is ancestor of 22458 Particular case, the tile 22 is ancestor of 22

py3dtiles.tilers.point.point_tiler.is_ancestor_in_list(node_name: bytes, ancestors: set[bytes] | dict[bytes, Any]) bool[source]#