py3dtiles.utils module

class py3dtiles.utils.SubdivisionType(value)[source]

Bases: Enum

An enumeration.

OCTREE = 1
QUADTREE = 2
py3dtiles.utils.aabb_size_to_subdivision_type(size: ndarray[Any, dtype[floating[_T]]]) SubdivisionType[source]
py3dtiles.utils.compute_spacing(aabb: ndarray[Any, dtype[floating[_T]]]) float[source]
py3dtiles.utils.make_aabb_cubic(aabb: ndarray[Any, dtype[floating[_T]]]) ndarray[Any, dtype[floating[_T]]][source]
py3dtiles.utils.make_aabb_valid(aabb: ndarray[Any, dtype[float64]]) None[source]

Modify inplace the aabb so that no dimension is 0-sized

py3dtiles.utils.mkdir_or_raise(folder: Path, overwrite: bool = False) None[source]

Create a folder if it can (it doesn’t exist or is empty).

If folder is a file or is not empty, raise a FileExistsError.

If overwrite is True, delete a possibly existing folder. Never delete anything if it is not a folder.

Parameters:
  • folder – Path object representing the needed folder

  • overwrite – Whether this method can brutally remove existing non-empty folder. Warning this is *destructive* and the equivalent of rm -rf folder, you have been warn.

Raises:

FileExistsError – when folder is actually a file or a non-empty folder.

py3dtiles.utils.node_from_name(name: bytes, parent_aabb: npt.NDArray[np.floating[_T]], parent_spacing: float) Node[source]
py3dtiles.utils.node_name_to_path(working_dir: Path, name: bytes, suffix: str = '', split_len: int = 8) Path[source]

Get the path of a tile from its name and the working directory. If the name is ‘222262175’ with the suffix ‘.pnts’, the result is ‘working_dir/22226217/r5.pnts’

py3dtiles.utils.profile(func: Callable[Param, RetType]) Callable[Param, RetType][source]
py3dtiles.utils.split_aabb(aabb: ndarray[Any, dtype[floating[_T]]], index: int, force_quadtree: bool = False) ndarray[Any, dtype[floating[_T]]][source]
py3dtiles.utils.str_to_CRS(srs: str | CRS | None) CRS | None[source]

Convert a string in a pyproj CRS object. The string could be an epsg code or a Proj4 string. If srs is already a CRS object, the function returns the same CRS definition.