Buildings & Roads
Configuration classes for buildings and roads.
s2gos_generator.core.config.buildings.BuildingsConfig
pydantic-model
Bases: BaseModel
Configuration for building generation.
The building tile directory is configured once in s2gos_settings.yaml via
generator.files.building_tiles (like the DEM and landcover datasets); this
config only controls whether buildings are generated and how they look.
Fields:
-
enabled(bool) -
index_csv(str) -
layer_name(str) -
height_column(str) -
object_id_prefix(str) -
default_height_m(float) -
story_height_m(float) -
material(Union[str, dict[str, float]]) -
material_seed(Optional[int]) -
pitched_roof_proportion(float) -
pitched_roof_min_area_m2(Optional[float]) -
pitched_roof_min_height_m(Optional[float]) -
roof_pitch_deg(float) -
roof_height_m(float) -
roof_material(str) -
roof_seed(Optional[int]) -
elevation_offset_m(float) -
base_skirt_m(float) -
roof_workers(Optional[int])
Validators:
-
_check_material
Attributes
base_skirt_m
pydantic-field
Extrude this far below the building base so steep terrain doesn't expose a gap between footprint and DEM.
elevation_offset_m
pydantic-field
Extra Z offset added on top of the DEM-sampled base.
height_column
pydantic-field
Column with building height. Accepts either a numeric height in meters or a building-taxonomy string (e.g. 'HHT:10.0', 'H:3', 'HAPP:3', 'HBET:1-3'). Buildings whose value is missing or unparseable fall back to default_height_m.
index_csv
pydantic-field
Index CSV filename (quadkey -> filename), relative to the building tile directory.
material
pydantic-field
Either a single material name applied to every building, or a {name: weight} mapping. Weights are normalized; each building is assigned one material drawn by weighted random sampling, then buildings are grouped into one mesh per material.
material_seed
pydantic-field
Seed for reproducible per-building material assignment.
object_id_prefix
pydantic-field
Prefix for the generated scene-object ids. Buildings are merged into one mesh per material, so ids are '
pitched_roof_min_area_m2
pydantic-field
Footprint area below which a building stays flat-topped.
pitched_roof_min_height_m
pydantic-field
Building height below which it stays flat-topped.
pitched_roof_proportion
pydantic-field
Fraction of eligible buildings that get a pitched roof. 0 disables pitched roofs entirely (flat-top everywhere).
roof_height_m
pydantic-field
Target roof height (apex above eaves). Capped per-building when the footprint is too narrow to support it at the configured pitch.
roof_material
pydantic-field
Material name applied to the roof mesh group.
roof_seed
pydantic-field
Seed for reproducible per-building pitched/flat selection.
roof_workers
pydantic-field
Number of worker processes to use for per-building mesh construction. None defaults to max(os.cpu_count() // 2, 1). Set to 1 for sequential execution (useful for debugging or when subprocess overhead dominates the workload, e.g. very small scenes).
s2gos_generator.core.config.roads.RoadsConfig
pydantic-model
Bases: BaseModel
Configuration for road infrastructure in scenes.
Fields:
-
enabled(bool) -
source(Literal['overpass', 'file']) -
file_path(Optional[Path]) -
highway_types(Optional[list[str]]) -
highway_overrides(dict[str, HighwayOverride]) -
default_material(str) -
default_lane_width_m(float) -
default_shoulder_m(float) -
mesh_gradient_threshold(float) -
mesh_thin_road_skip_m(float)
Validators:
-
validate_file_source
Attributes
highway_overrides
pydantic-field
Per-highway-type overrides for geometry and material.
mesh_gradient_threshold
pydantic-field
Minimum DEM gradient magnitude (m/m) along a road centreline to trigger cross-slope mesh flattening for that segment (~1.1°). Set to 0.0 to always flatten regardless of terrain slope.
mesh_thin_road_skip_m
pydantic-field
Roads with total width (m) below this value are skipped (not flattened). Set to 0.0 to disable (flatten all roads regardless of width).
s2gos_generator.core.config.roads.HighwayOverride
pydantic-model
Bases: BaseModel
Per-highway-type override for geometry and material defaults.
Fields:
-
total_width_m(Optional[float]) -
lane_count(Optional[int]) -
lane_width_m(Optional[float]) -
default_material(Optional[str])