py3dtiles.tilers.base_tiler package

This package contains all the common files for tilers, especially abstract base classes a tiler must derive.

# How to create a tiler?

You should start by deriving the Tiler class.

class py3dtiles.tilers.base_tiler.SharedMetadata[source]

Bases: ABC

Base class with data that must be shared with worker tiler.

class py3dtiles.tilers.base_tiler.Tiler[source]

Bases: ABC, Generic[_SharedMetadataT, _TilerWorkerT]

Tiler abstract class, this list of attributes and methods is used by convert. This class will organize the different tasks and their order of dispatch to the TilerWorker instances.

You must set a name as class attribute and overwrite all abstract methods.

Some methods are not required, overwrite them only if needed (like validate_binary_data or memory_control)

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.

abstract get_tasks(startup: float) 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.

abstract get_worker() _TilerWorkerT[source]

Returns an instantiated tiler worker.

abstract initialization(crs_out: CRS | None, working_dir: Path, number_of_jobs: int) None[source]

The __init__ method must only set attributes without any action. It is in this method that this work must be done (and the initialization of shared_metadata).

The method will be called before all others.

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''
abstract print_debug(now: float, number_of_jobs: int, number_of_idle_clients: int) None[source]

Prints info about the progression of the conversion. Called everytime a tiler worker task is finished.

abstract print_summary() None[source]

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

abstract process_message(return_type: bytes, content: list[bytes]) bool[source]

Updates the state of the tiler in function of the return type and the returned data

shared_metadata: _SharedMetadataT
validate_binary_data() 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 write_tileset)

abstract write_tileset() None[source]

Writes the tileset file once the binary data written

class py3dtiles.tilers.base_tiler.TilerWorker(shared_metadata: _SharedMetadataT)[source]

Bases: ABC, Generic[_SharedMetadataT]

abstract execute(skt: Socket[bytes], command: bytes, content: list[bytes]) None[source]

Executes a command sent by the tiler. The method returns directly the response with the skt variable.

Submodules