Getting Started with Wemap SDK
The Wemap SDK provides comprehensive location tracking, routing, navigation, and map rendering capabilities for web applications. This guide will help you get started with the SDK.
Overview
The Wemap SDK is organized into several packages:
- @wemap/core: Core SDK initialization and configuration
- @wemap/geo: Geographic primitives (
Coordinates,BoundingBox) shared across the SDK - @wemap/map: Map rendering for Wemap livemaps (a maplibre-gl wrapper)
- @wemap/positioning: Location tracking and positioning (VPS, GNSS/WiFi)
- @wemap/routing: Route calculation and navigation
- @wemap/camera: Camera access for visual positioning
Installation
Install the packages you need:
# Map rendering (maplibre-gl is a peer dependency)
npm install @wemap/core @wemap/geo @wemap/map maplibre-gl
# Positioning, routing, camera
npm install @wemap/positioning @wemap/routing @wemap/camera
Coordinates
Coordinates and BoundingBox live in @wemap/geo — this is their canonical
home, and where the map guide imports them from:
import { Coordinates, BoundingBox } from '@wemap/geo';
// new Coordinates(lat, lng, alt?, level?)
const paris = new Coordinates(48.8566, 2.3522); // lat, lng
const indoor = new Coordinates(48.8566, 2.3522, null, 1); // + altitude, indoor level
The constructor takes lat, lng, an optional alt (height in meters, null by
default) and an optional level (indoor floor, null by default). Coordinates use
lat/lng — not lat/lon. For convenience, Coordinates is also re-exported
from @wemap/positioning and @wemap/routing, so you can import it from whichever
package you are already using.
Requirements
- Positioning (geolocation) and VPS (camera) require a secure context — the page
must be served over HTTPS (or
localhostin development). Browsers blockgetUserMediaand the Geolocation API on insecure origins. - A modern evergreen browser (Chrome, Edge, Firefox, Safari). VPS additionally needs a device camera and, on iOS, a user gesture to grant motion/orientation access (see the Positioning guide).
Core SDK Initialization
Before using any SDK features, you must initialize the Core SDK with your livemap ID and authentication token.
import { core } from '@wemap/core';
// Initialize the SDK
await core.init({
emmid: 'your-map-id',
token: 'your-authentication-token',
env: 'production' // or 'development'
});
Initialization Options
- emmid (required): Your livemap ID
- token (required): Authentication token for API access
- env (optional): Environment -
'production'(default) or'development'
The Core SDK initialization fetches livemap configuration data used by the other
packages — the map style, bounds and indoor settings for @wemap/map, the VPS
endpoint for @wemap/positioning, and so on.