Skip to content

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:

Validators:

  • _check_material

Attributes

base_skirt_m pydantic-field

base_skirt_m: float = 0.5

Extrude this far below the building base so steep terrain doesn't expose a gap between footprint and DEM.

elevation_offset_m pydantic-field

elevation_offset_m: float = 0.0

Extra Z offset added on top of the DEM-sampled base.

height_column pydantic-field

height_column: str = 'height'

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: str = 'openbuildingmap.csv'

Index CSV filename (quadkey -> filename), relative to the building tile directory.

layer_name pydantic-field

layer_name: str = 'building'

GPKG layer name to read.

material pydantic-field

material: Union[str, dict[str, float]] = 'concrete'

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

material_seed: Optional[int] = None

Seed for reproducible per-building material assignment.

object_id_prefix pydantic-field

object_id_prefix: str = 'building'

Prefix for the generated scene-object ids. Buildings are merged into one mesh per material, so ids are '' (single material), '', and '_roof'.

pitched_roof_min_area_m2 pydantic-field

pitched_roof_min_area_m2: Optional[float] = None

Footprint area below which a building stays flat-topped.

pitched_roof_min_height_m pydantic-field

pitched_roof_min_height_m: Optional[float] = None

Building height below which it stays flat-topped.

pitched_roof_proportion pydantic-field

pitched_roof_proportion: float = 0.0

Fraction of eligible buildings that get a pitched roof. 0 disables pitched roofs entirely (flat-top everywhere).

roof_height_m pydantic-field

roof_height_m: float = 3.0

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

roof_material: str = 'baresoil'

Material name applied to the roof mesh group.

roof_pitch_deg pydantic-field

roof_pitch_deg: float = 30.0

Pitch angle for hip roofs.

roof_seed pydantic-field

roof_seed: Optional[int] = None

Seed for reproducible per-building pitched/flat selection.

roof_workers pydantic-field

roof_workers: Optional[int] = None

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:

Validators:

  • validate_file_source

Attributes

enabled pydantic-field

enabled: bool = True

Enable road processing

file_path pydantic-field

file_path: Optional[Path] = None

Path to road data JSON file

highway_overrides pydantic-field

highway_overrides: dict[str, HighwayOverride]

Per-highway-type overrides for geometry and material.

highway_types pydantic-field

highway_types: Optional[list[str]] = None

Highway types to include

mesh_gradient_threshold pydantic-field

mesh_gradient_threshold: float = 0.02

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

mesh_thin_road_skip_m: float = 0.0

Roads with total width (m) below this value are skipped (not flattened). Set to 0.0 to disable (flatten all roads regardless of width).

source pydantic-field

source: Literal['overpass', 'file'] = 'overpass'

Data source for road geometry

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])