OverpassBuildingsSource

class OverpassBuildingsSource(val endpoint: String = "https://overpass-api.de/api/interpreter", val timeout: Int = 25) : TiledFeatureSource

Fetches OSM building footprints from a public Overpass API endpoint.

One request per Sector is issued, returning all ways tagged either building=* or building:part=* whose geometry is inside the bbox. Parts are emitted alongside their parent shell (Overpass unions de-dupe by id, so a way tagged both ways still appears once); each part has its own height/min_height, so a tower-on-podium reads as two stacked volumes without any extra assembly logic.

Multipolygon (relation-based) buildings are intentionally not assembled here — they are rare for buildings and would require a second round-trip; callers needing them can layer a relation-aware source on top of this one.

Heights are derived via OsmHeight.resolve; coordinates are emitted as Positions with the top-altitude pre-baked, ready for OsmBuildingsLayer to wrap in an extruded earth.worldwind.shape.Polygon with earth.worldwind.geom.AltitudeMode.RELATIVE_TO_GROUND.

Parameters

endpoint

Overpass-compatible HTTP endpoint. Defaults to the public main instance — for production use, route to a self-hosted mirror to respect fair-use limits.

timeout

Per-request Overpass timeout, also wired into the QL [timeout:N]; header.

Constructors

Link copied to clipboard
constructor(endpoint: String = "https://overpass-api.de/api/interpreter", timeout: Int = 25)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
open override fun close()

Release any resources held by the source (HTTP client, etc.). Idempotent default no-op.

Link copied to clipboard
open suspend override fun fetchTile(z: Int, x: Int, y: Int, sector: Sector): Flow<CachedFeatureRow>?
Link copied to clipboard
open suspend fun tryReadCachedTile(z: Int, x: Int, y: Int, sector: Sector): Flow<CachedFeatureRow>?

Cache-only fast-path read for (z, x, y). Default returns null — a plain network source has no cache to consult. Cache-backed sources override to read their store without going through the network-fetch concurrency budget. Empty flow is the negative-cache sentinel ("fetched, no features"); null is a true miss.