py3dtiles.tileset.metadata module#

Description of the 3DTiles metadata, as denoted in https://docs.ogc.org/cs/22-025r4/22-025r4.html#toc40.

class py3dtiles.tileset.metadata.CompositeMetadataProperty(property_type: Literal['SCALAR', 'VEC2', 'VEC3', 'VEC4', 'MAT2', 'MAT3', 'MAT4'], component_type: Literal['INT8', 'UINT8', 'INT16', 'UINT16', 'INT32', 'UINT32', 'INT64', 'UINT64', 'FLOAT32', 'FLOAT64'], *, name: str | None = None, description: str | None = None, array: bool = False, required: bool = False, offset: int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | float32 | float64 | ndarray[tuple[int, ...], dtype[int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | float32 | float64]] | None = None, scale: int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | float32 | float64 | ndarray[tuple[int, ...], dtype[int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | float32 | float64]] | None = None, minimum: int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | float32 | float64 | ndarray[tuple[int, ...], dtype[int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | float32 | float64]] | None = None, maximum: int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | float32 | float64 | ndarray[tuple[int, ...], dtype[int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | float32 | float64]] | None = None, nodata: int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | float32 | float64 | ndarray[tuple[int, ...], dtype[int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | float32 | float64]] | None = None, default: int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | float32 | float64 | ndarray[tuple[int, ...], dtype[int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | float32 | float64]] | None = None)[source]#

Bases: MetadataProperty

Define a 3DTiles metadata property for SCALAR, VEC and MAT types.

component_type: Literal['INT8', 'UINT8', 'INT16', 'UINT16', 'INT32', 'UINT32', 'INT64', 'UINT64', 'FLOAT32', 'FLOAT64']#
property_type: Literal['SCALAR', 'VEC2', 'VEC3', 'VEC4', 'MAT2', 'MAT3', 'MAT4']#
to_json() dict[str, Any][source]#

Convert the property to a JSON-like dictionary.

Returns:

Dictionary version of the metadata property.

class py3dtiles.tileset.metadata.EnumMetadataProperty(enum_type: str, *, name: str | None = None, description: str | None = None, array: bool = False, required: bool = False, offset: int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | float32 | float64 | ndarray[tuple[int, ...], dtype[int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | float32 | float64]] | None = None, scale: int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | float32 | float64 | ndarray[tuple[int, ...], dtype[int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | float32 | float64]] | None = None, minimum: int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | float32 | float64 | ndarray[tuple[int, ...], dtype[int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | float32 | float64]] | None = None, maximum: int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | float32 | float64 | ndarray[tuple[int, ...], dtype[int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | float32 | float64]] | None = None, nodata: int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | float32 | float64 | ndarray[tuple[int, ...], dtype[int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | float32 | float64]] | None = None, default: int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | float32 | float64 | ndarray[tuple[int, ...], dtype[int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | float32 | float64]] | None = None)[source]#

Bases: MetadataProperty

Define a 3DTiles metadata property for ENUM types.

enum_type: str#
property_type: Literal['ENUM'] = 'ENUM'#
to_json() dict[str, Any][source]#

Convert the property to a JSON-like dictionary.

Returns:

Dictionary version of the metadata property.

class py3dtiles.tileset.metadata.MetadataClass(name: str | None = None, description: str | None = None, properties: dict[str, ~py3dtiles.tileset.metadata.MetadataProperty] = <factory>)[source]#

Bases: object

Define a 3DTiles metadata class, composed of enums and properties.

add_property(identifier: str, new_property: MetadataProperty) None[source]#

Add a new property to the metadata class.

Parameters:
  • identifier – ID of the metadata property within the metadata class.

  • new_property – Property to add.

description: str | None = None#
name: str | None = None#
properties: dict[str, MetadataProperty]#
to_json() dict[str, Any][source]#

Convert the metadata class to a JSON-like dictionary.

Returns:

Dictionary version of the metadata class.

class py3dtiles.tileset.metadata.MetadataEnum(values: dict[str, ~numpy.int8 | ~numpy.uint8 | ~numpy.int16 | ~numpy.uint16 | ~numpy.int32 | ~numpy.uint32 | ~numpy.int64 | ~numpy.uint64] = <factory>, name: str | None = None, description: str | None = None)[source]#

Bases: object

Define a 3DTile metadata enum.

description: str | None = None#
name: str | None = None#
to_json() dict[str, Any][source]#

Convert the metadata enum to a JSON-like dictionary.

Returns:

Dictionary version of the metadata enum.

values: dict[str, int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64]#
class py3dtiles.tileset.metadata.MetadataProperty(property_type: Literal['SCALAR', 'VEC2', 'VEC3', 'VEC4', 'MAT2', 'MAT3', 'MAT4', 'BOOLEAN', 'STRING', 'ENUM'], *, name: str | None = None, description: str | None = None, array: bool = False, required: bool = False, offset: int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | float32 | float64 | ndarray[tuple[int, ...], dtype[int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | float32 | float64]] | None = None, scale: int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | float32 | float64 | ndarray[tuple[int, ...], dtype[int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | float32 | float64]] | None = None, minimum: int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | float32 | float64 | ndarray[tuple[int, ...], dtype[int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | float32 | float64]] | None = None, maximum: int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | float32 | float64 | ndarray[tuple[int, ...], dtype[int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | float32 | float64]] | None = None, nodata: int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | float32 | float64 | ndarray[tuple[int, ...], dtype[int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | float32 | float64]] | None = None, default: int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | float32 | float64 | ndarray[tuple[int, ...], dtype[int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | float32 | float64]] | None = None)[source]#

Bases: ABC

Define a 3DTiles metadata property.

array: bool = False#
default: int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | float32 | float64 | ndarray[tuple[int, ...], dtype[int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | float32 | float64]] | None = None#
description: str | None = None#
maximum: int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | float32 | float64 | ndarray[tuple[int, ...], dtype[int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | float32 | float64]] | None = None#
minimum: int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | float32 | float64 | ndarray[tuple[int, ...], dtype[int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | float32 | float64]] | None = None#
name: str | None = None#
nodata: int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | float32 | float64 | ndarray[tuple[int, ...], dtype[int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | float32 | float64]] | None = None#
offset: int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | float32 | float64 | ndarray[tuple[int, ...], dtype[int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | float32 | float64]] | None = None#
property_type: Literal['SCALAR', 'VEC2', 'VEC3', 'VEC4', 'MAT2', 'MAT3', 'MAT4', 'BOOLEAN', 'STRING', 'ENUM']#
required: bool = False#
scale: int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | float32 | float64 | ndarray[tuple[int, ...], dtype[int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | float32 | float64]] | None = None#
abstract to_json() dict[str, Any][source]#
class py3dtiles.tileset.metadata.MetadataSchema(identifier: str, name: str | None = None, version: str | None = None, description: str | None = None, enums: dict[str, ~py3dtiles.tileset.metadata.MetadataEnum] = <factory>, classes: dict[str, ~py3dtiles.tileset.metadata.MetadataClass] = <factory>)[source]#

Bases: object

Contient un ensemble de classes et enums.

add_class(identifier: str, cls: MetadataClass) None[source]#
add_enum(identifier: str, enum: MetadataEnum) None[source]#
classes: dict[str, MetadataClass]#
description: str | None = None#
enums: dict[str, MetadataEnum]#
identifier: str#
name: str | None = None#
to_json() dict[str, Any][source]#
version: str | None = None#
class py3dtiles.tileset.metadata.SimpleMetadataProperty(property_type: Literal['BOOLEAN', 'STRING'], *, name: str | None = None, description: str | None = None, array: bool = False, required: bool = False, offset: int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | float32 | float64 | ndarray[tuple[int, ...], dtype[int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | float32 | float64]] | None = None, scale: int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | float32 | float64 | ndarray[tuple[int, ...], dtype[int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | float32 | float64]] | None = None, minimum: int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | float32 | float64 | ndarray[tuple[int, ...], dtype[int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | float32 | float64]] | None = None, maximum: int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | float32 | float64 | ndarray[tuple[int, ...], dtype[int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | float32 | float64]] | None = None, nodata: int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | float32 | float64 | ndarray[tuple[int, ...], dtype[int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | float32 | float64]] | None = None, default: int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | float32 | float64 | ndarray[tuple[int, ...], dtype[int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | float32 | float64]] | None = None)[source]#

Bases: MetadataProperty

Define a 3DTiles metadata property for simple types (BOOLEAN, STRING).

property_type: Literal['BOOLEAN', 'STRING']#
to_json() dict[str, Any][source]#

Convert the property to a JSON-like dictionary.

Returns:

Dictionary version of the metadata property.

py3dtiles.tileset.metadata.check_identifier_validity(identifier: str) str[source]#

Check if an identifier is valid relatively to the 3DTiles standard.

Identifiers are strings that match the regular expression ^[a-zA-Z_][a-zA-Z0-9_]*$: Strings that consist of upper- or lowercase letters, digits, or underscores, starting with either a letter or an underscore.

Parameters:

identifier – metadata identifier.

Returns:

the identifier itself, if it is valid

Raises:

InvalidIdentifierException – if the provided identifier does not respect the naming

convention.

py3dtiles.tileset.metadata.is_identifier_character_valid(char: str, first_char: bool = True) bool[source]#

Check if an identifier character is valid.

A metadata identifier should contains (lowercase or uppercase) letters, underscores

Parameters:
  • char – a character within a metadata identifier.

  • first_char – True if this is the starting character, False otherwise.