Road Processors
Fetch and parse OpenStreetMap road geometry, (de)serialize the roads sidecar, and build the terrain-flatten operations that sit roads on well-resolved terrain. For the concept and configuration, see Roads and Buildings & Roads config.
Fetching & parsing
s2gos_generator.processors.roads.fetch_osm_data
Fetch or load OSM road data based on config source.
s2gos_generator.processors.roads.parse_roads
Parse OSM road ways into Road segments, clipped to scene bounds.
s2gos_generator.processors.roads.Road
dataclass
A single road segment in scene coordinates.
s2gos_generator.processors.roads.RoadsFetchError
Bases: RuntimeError
Raised when the Overpass API fails on every retry attempt.
Sidecar (de)serialization
s2gos_generator.processors.roads.roads_to_sidecar
Serialize road segments to the roads-sidecar structure.
s2gos_generator.processors.roads.roads_from_sidecar
Reconstruct road segments from the roads-sidecar structure.
Returns an empty list for an unrecognised schema version.
Terrain flattening
s2gos_generator.processors.roads.build_road_terraform_operations
build_road_terraform_operations(
roads: list[Road],
dem_data,
*,
transition_buffer_m: float,
gradient_threshold: float,
thin_road_skip_m: float,
) -> list
Build terrain-flatten operations for roads using a DEM gradient filter.
Returns an empty list when there are no road segments or all are filtered out by the gradient threshold.