py3dtiles.tileset.tile module#

class py3dtiles.tileset.tile.Tile(geometric_error: float = 500, bounding_volume: BoundingVolume[Any] | None = None, transform: ndarray[Any, dtype[float64]] = array([[1., 0., 0., 0.], [0., 1., 0., 0.], [0., 0., 1., 0.], [0., 0., 0., 1.]]), refine_mode: Literal['ADD', 'REPLACE'] = 'ADD', content_uri: Path | str | None = None)[source]#

Bases: RootProperty[TileDictType]

Represents a Tile in the 3dtiles specs

add_child(tile: Tile) None[source]#
change_base(from_path: Path, to_path: Path) None[source]#

Change the base for all the relative tile content uri. For instance, calling tile.change_base(Path(“outfolder/points”), Path(“outfolder/”)) would change the content uri to points/path/to/content.pnts.

It’s useful to transfer a tile to another tileset. For instance, let’s say tile t has been loaded from the on disk tileset1 and you want to use this tile in tileset2. If you want to keep the binary tile contents in the same place in the file hierarchy, you can just do:

`python t.change_base(tileset1.root_uri, tileset2.root_uri) `

delete_on_disk(root_uri: Path, delete_sub_tileset: bool = False) None[source]#

Deletes all files linked to the tile and its children. The uri of the folder where tileset is, should be defined.

Parameters:
  • root_uri – The folder where tileset is.

  • delete_sub_tileset – If True, all tilesets present as tile content will be removed as well as their content. If False, the linked tilesets in tiles won’t be removed.

classmethod from_dict(tile_dict: TileDictType) Tile[source]#
get_all_children() list[Tile][source]#
Returns:

the recursive (across the children tree) list of the children tiles

get_or_fetch_content(root_uri: Path | None) TileContent | TileSet[source]#

If a tile_content content has been set, returns this content. If the tile content is None and a tile_content uri has been set, the tile will load the file and return its content.

Parameters:

root_uri – the base uri which tile.content_uri is relative to. Usually the directory containing the tileset containing this tile.

get_refine_mode() Literal['ADD', 'REPLACE'][source]#
get_transformed_bounding_volume() BoundingVolume[Any][source]#

Get the bounding volume of this tile, transformed according to this tile transformation.

This bounding volume is therefore in the parent’s local coordinate system, possibly the world coordinate if this tile has no parent.

has_content() bool[source]#

Returns if there is a tile content (loaded or not).

has_content_loaded() bool[source]#

Returns if there is a tile content loaded in this tile.

set_refine_mode(mode: Literal['ADD', 'REPLACE']) None[source]#
sync_bounding_volume_with_children() None[source]#
to_dict() TileDictType[source]#
transform_coord(coord: ndarray[Any, dtype[T]]) ndarray[Any, dtype[T]][source]#

Transform one coordinate according to this tile transformation property.

NOTE: this only applies the current tile transformation, not the transformation of ancestors

transform_coords(coords: ndarray[Any, dtype[T]]) ndarray[Any, dtype[T]][source]#

Transform coordinates according to this tile transformation property.

NOTE: this only applies the current tile transformation, not the transformation of ancestors

write_content(root_uri: Path | None) None[source]#

Write (or overwrite) the tile content to the directory specified as parameter and withing the relative filename designated by the tile’s content uri.

Parameters:

root_uri – the base uri of this tile, usually the folder where the tileset is