Osm Buildings Layer
Renders OpenStreetMap-derived schematic 3D buildings. Footprints + height tags are fetched on demand via a TiledFeatureSource (defaults to OverpassBuildingsSource) and cached per slippy-map tile.
Each cached tile is either:
a single OsmBuildingsTile (default, useBatchedRendering = true) — one VBO + one EBO for every building in the tile. Required at dense urban density: per-building polygons OOM the Adreno KGSL shared-memory pool by buffer count, not byte volume.
a
List<Polygon>, one extruded Polygon per OsmBuilding — the legacy path. Needed by subclasses overriding toPolygon / toPolygons for per-building customisation the batched mesh doesn't carry; pass useBatchedRendering = false.
useOsmColors works in both modes — the batched path groups triangles by colour within the tile's element array and issues one sub-draw per colour.
val buildings = OsmBuildingsLayer()
worldWindow.engine.layers.addLayer(buildings)
// ...later:
buildings.close()Tile selection uses a centre-radius window: at each frame the (2×tileRadius+1)² tiles around the camera's lookAt point (falling back to the camera lat/lon) are scheduled for fetch. At zoom 15 a radius of 4 covers ~10 km square. Fetching is gated by maxActiveAltitude (30 km by default), above which the layer is a no-op.
Style every building uniformly via attributes, or enable useOsmColors for per-tag wall/roof colouring. Always call close to cancel in-flight fetches.
Types
The render-config subset persisted into WebServiceInfo.metadata on cache attach and replayed on reopen, so a cached layer comes back with its original flags instead of bare constructor defaults (the white-buildings-on-reopen bug when useOsmColors was set). Only the val constructor params are carried; attributes / shadowMode are not. Defaults mirror the constructor so an absent field decodes to the same value.
Properties
Shape attributes applied to every building polygon. Mutating between frames is safe.
See TiledImageLayer.cachedSourceInfo — same shape for OSM buildings.
Vector content bounding sector — real data availability can be smaller than the tile grid. Full sphere by default; tiled layers skip tiles outside it. Cache reopen narrows it from the persisted content bbox; bulk download widens and persists it. Mirrors earth.worldwind.globe.elevation.coverage.ElevationCoverage.sector.
Layer-wide shadow participation. Default ShadowMode.ENABLED makes every building both cast shadows onto the terrain and receive cascade shadows. Applies in both batched and legacy rendering paths; in the legacy path it overrides any per-Polygon ShapeAttributes.shadowMode so layer-level intent wins.
When true (default), every building in a tile is packed into one OsmBuildingsTile mesh (~500× fewer GL buffers per tile). Set false to keep the legacy "one Polygon per building" path — required when overriding toPolygon / toPolygons for per-building customisation the batched path doesn't carry (e.g. per-building geometry variation).
When true, walls are coloured via OsmColors.resolve on each OsmBuilding's tags (falling back to attributes's interior colour); top caps use roof:colour (falling back to the wall colour). On by default; set false for uniform-gray output. Works in both rendering modes.
Functions
Makes a fresh copy carrying this layer's configuration + appearance; caches and fetch scope are not shared.
Download every OSM-Buildings feature tile intersecting sector into the layer's feature store — the "save a region for offline use" flow.
See setOfflineOnly on TiledImageLayer. Dispatches by VectorLayer subtype to reach the right source field. No-op for unknown subtypes.
Total number of OSM-Buildings feature tiles launchBulkRetrieval would fetch for sector — the slippy analog of LevelSet.tileCount, for sizing a download before committing to it. Counts a single slippy zoom (OsmBuildingsLayer.tileZoom), the only zoom the renderer reads.