Skip to main content

BuildingService

wemap-sdk-js


Class: BuildingService

Fetches buildings of a livemap from the Wemap API, with bbox-based caching.

First lookup downloads every building of the livemap (paginated) and caches them against an expanded bbox; subsequent lookups whose viewport is still inside the cached bbox are served from memory. Each lookup returns only the buildings whose bbox intersects the requested viewport.

Do not instantiate this directly — retrieve a configured instance with core.createBuildingService().

Constructors

Constructor

new BuildingService(baseUrl, emmid): BuildingService

Parameters

baseUrl

string

Base URL of the Wemap API (e.g. https://api.getwemap.com/v3.0).

emmid

string | number

The livemap id whose buildings to fetch.

Returns

BuildingService

Properties

MIN_BBOX_SIZE

static MIN_BBOX_SIZE: number = 3000

Minimum bbox size (meters) the cache is expanded to, to limit API calls.

Methods

getBuildingsFromBbox()

getBuildingsFromBbox(bbox): Promise<Building[]>

Return the buildings whose bbox intersects bbox, fetching from the API when the cache does not already cover the requested viewport.

Parameters

bbox

BoundingBox

Returns

Promise<Building[]>