Core Package
The core package provides the foundational functionality for the Wemap SDK, including initialization, configuration management, and HTTP client services.
Features
- SDK Initialization: Initialize the SDK with your livemap ID and authentication token
- Configuration Management: Access global configuration across all SDK packages
- HTTP Client: Robust HTTP client with automatic JSON parsing, error handling, and timeout support
- Livemap Service: Fetch and parse livemap data from the Wemap API
- Geocoding: Forward and reverse geocoding via the Wemap geocoding API
Getting Started
import { core } from '@wemap/core';
// Initialize the SDK
await core.init({
emmid: 'your-emmid',
token: 'your-token'
});
// Access configuration
const config = CoreConfig.getConfig();
Main Classes
- CoreConfig: Main configuration class for SDK initialization
- HttpClient: HTTP client for making API requests
- LivemapService: Service for fetching livemap data
- GeocodingService: Forward and reverse geocoding
Content search / pinpoint search
After core.init(), use createPinpointManager() to search pinpoints in the
current viewport. Bounds are required — pass ...boundsToDelta(map.getBounds())
from @wemap/core:
import { boundsToDelta, core } from '@wemap/core';
await core.init({ emmid, token });
const pinpointManager = core.createPinpointManager();
const { items, count, next } = await pinpointManager.search({
query: 'café',
...boundsToDelta(map.getBounds()),
level: map.getLevel() ?? undefined,
limit: 20,
offset: 0,
});
Search results are upserted into a shared internal cache (one per livemap).
@wemap/map uses the same cache for invisible viewport preload and to resolve
full Pinpoint entities on POI click — integrators do not manage the cache.
Query normalisation (livemap parity):
levelalone becomeslevels: "null,<level>"; when bothlevelandlevelsare set,levelswins.tagsacceptsstring | string[](arrays are joined with,).- Default
query_mode: 'phrase'. - Pinpoint API calls do not send
Authorization.
The exported Pinpoint type is a minimal read model: id, name,
description?, coordinates, level?, altitude?, tags?, category?,
image_url?, address?.
Geocoding
Forward and reverse geocoding against https://geocoding.getwemap.workers.dev.
Does not require core.init():
import { GeocodingService, core } from '@wemap/core';
const geocoding = core.createGeocodingService({ language: 'fr', region: 'fr' });
// or: new GeocodingService({ language: 'fr' })
const place = await geocoding.search('Paris');
const places = await geocoding.searchMultiple('Paris');
const address = await geocoding.reverseGeocode(48.85, 2.35);
GeocodingResult exposes id, placeType, relevance, text, placeName,
language?, latitude, longitude, and optional bbox as
[west, south, east, north]. Per-call language / region / bbox override
constructor defaults.
Tags & categories
Livemaps ship with a tag configuration:
the tags used to classify pinpoints, and the categories they can be grouped by.
Read them after core.init() to build tag filters, legends or category menus:
import { CoreConfig, core } from '@wemap/core';
await core.init({ emmid: '31668', token: 'YOUR_TOKEN' });
const { tags, categories } = CoreConfig.getTagsConfig();
// e.g. group tags by category slug
const transport = tags.filter((tag) => tag.category === 'transport');
Each LivemapTag exposes name, slug, and optional category (a category
slug), color and icon. A pinpoint references its tags by slug
(Pinpoint.tags), so you can join the two. Each LivemapTagCategory exposes
name and slug. Both arrays are empty when the livemap has no tags.
core
Classes
Interfaces
- GeocodingResult
- GeocodingSearchOptions
- GeocodingServiceOptions
- IndoorLevel
- IndoorOptions
- InitOptions
- LivemapTag
- LivemapTagCategory
- LivemapTagsConfig
- Pinpoint
- PinpointBoundsParams
- PinpointSearchQuery
- PinpointSearchResponse
- WemapTheme