class City(dtcc.Object)[source]

Represents a city, the top-level container class for city models.

Public members

property buildings

Return list of buildings in city.

property terrain

Return terrain in city.

property num_buildings

Return number of buildings in city.

get_building_attribute(attribute)[source]

Return list of values for a specific building attribute.

set_building_attribute(attribute, values)[source]

Set specific building attribute for all buildings.

get_building_attributes()[source]
add_terrain(terrain)[source]

Add terrain to city.

remove_terrain()[source]
remove_buildings()[source]
add_building(building: Building)[source]

Add building to city.

add_buildings(buildings: list[Building], ...)[source]

Add building to city. :param buildings: list[Building]

List of buildings to add to the city.

Parameters:
remove_outside_terrain

bool If True, remove buildings that are outside the terrain.

to_proto() Object[source]

Return a protobuf representation of the City.

from_proto(pb: Object | bytes)[source]

Initialize City from a protobuf representation.

City(id: str = <factory>, attributes: dict = <factory>, ...)

Initialize self. See help(type(self)) for accurate signature.

__repr__()

Return repr(self).

__eq__(other)

Return self==value.

load()
save(path)
simplify_buildings(tolerance=0.1) City

Simplify the footprint of buildings in a City object.

remove_small_buildings(min_area=10) City

Remove small buildings from a City object.

merge_buildings(max_distance=0.15, min_area=10, ...) City

Merge buildings that are close together.

fix_building_clearance(target_clearance: float, ...) City

Fix the clearance of the footprints in the building models. After running each building should have a minimum_clearance of tol meters and a minimum angle between each edge of min_angle degrees.

view()

View a mesh in 3D with a GLFW window.

property num_children

Return number of child objects.

property lod0

Return LOD0 geometry.

property lod1

Return LOD0 geometry.

property lod2

Return LOD0 geometry.

property lod3

Return LOD0 geometry.

property mesh

Return LOD0 geometry.

property volume_mesh

Return LOD0 geometry.

property point_cloud

Return POINT_CLOUD geometry.

property raster

Return RASTER geometry.

property bounds

Return BOUNDS geometry.

add_child(child)[source]

Add child object.

add_children(children)[source]

Adds a list of children objects.

add_geometry(geometry: Geometry, geometry_type: GeometryType | str)[source]

Add geometry to object.

add_field(field, geometry_type)[source]

Add a field to a geometry of the object.

get_children(child_type)[source]
set_child_attributues(child_type, attribute, values)[source]
get_child_attributes(child_type, attribute, default=None)[source]
flatten_geometry(geom_type: GeometryType)[source]

Returns a single geometry of the specified type, merging all the geometries of the children.

calculate_bounds(lod=None)[source]

Calculate the bounding box of the object.

defined_geometries()[source]

Return a list of the types of geometries defined on this object.

defined_attributes()[source]

Return a list of the attributes defined on this object.

id : str
attributes : dict
children : dict
geometry : dict
to_json() str

Return a JSON representation of the object.

copy(**kwargs)

Return a copy of the object.

classmethod add_methods(module, name=None)

Adds methods from a module or function to the class.

classmethod print_methods(verbose=False)

Print the methods that have been added to the class.