CoreConfig
Class: CoreConfig
Core configuration class for initializing the Wemap SDK
This class handles SDK initialization, fetches livemap data from the API, and provides access to the global configuration.
Example
import { core } from '@wemap/core';
// Initialize the SDK
await core.init({
emmid: 'your-emmid',
token: 'your-token',
env: 'production'
});
// Access configuration
const config = CoreConfig.getConfig();
Methods
createBuildingProvider()
createBuildingProvider(): (
bbox) =>Promise<Building[]>
Build a building provider for the initialized livemap: a function that returns the buildings whose bbox intersects a given viewport.
This is the concrete data source @wemap/map uses for building selection
when indoor.enable is set in the livemap snippet. Integrators normally
don't call it directly.
await core.init({ emmid, token });
const provider = core.createBuildingProvider();
const buildings = await provider(map.getBounds());
Returns
A (bbox) => Promise<Building[]> bound to this livemap.
(bbox) => Promise<Building[]>
createBuildingService()
createBuildingService():
BuildingService
Build a building service for the initialized livemap.
await core.init({ emmid, token });
const service = core.createBuildingService();
const buildings = await service.getBuildingsFromBbox(map.getBounds());
Returns
A BuildingService bound to this livemap.
createGeocodingService()
createGeocodingService(
options?):GeocodingService
Build a geocoding client (forward + reverse) against the Wemap geocoding API.
Does not require core.init() — pass language / region / bbox defaults
via options when needed.
const geocoding = core.createGeocodingService({ language: 'fr', region: 'fr' });
const place = await geocoding.search('Paris');
const address = await geocoding.reverseGeocode(48.85, 2.35);
Parameters
options?
Returns
createPinpointManager()
createPinpointManager():
PinpointManager
Build a pinpoint manager bound to the initialized livemap.
await core.init({ emmid, token });
const pinpoints = core.createPinpointManager();
const { items } = await pinpoints.search({
query: 'café',
...boundsToDelta(map.getBounds()),
level: map.getLevel() ?? undefined,
});
Returns
createWallService()
createWallService():
WallService
Build a wall service for the initialized livemap.
await core.init({ emmid, token });
const service = core.createWallService();
const walls = await service.searchWalls(venueId);
Returns
A WallService bound to this livemap.
init()
init(
initOptions):Promise<void>
Initialize the core SDK
Fetches livemap data from the API using the provided emmid and token, or
parses an already-fetched livemap without any request.
This must be called before using other SDK features that depend on configuration.
Parameters
initOptions
Initialization options
Returns
Promise<void>
Throws
If neither livemap nor both emmid and token are given
Example
await core.init({
emmid: 'abc123',
token: 'xyz789',
env: 'production'
});
// Livemap already fetched by the host app:
await core.init({ livemap, env: 'development' });
getClientInfo()
staticgetClientInfo():ClientInfo
The application identity passed to core.init (empty when none was given).
SDK packages merge it over their own defaults when calling backends.
Returns
getIndoorOptions()
staticgetIndoorOptions():IndoorOptions
Indoor settings from the livemap snippet (indoor.enable, indoor.minZoom).