Maps JS
@woosmap/map is a browser-based mapping library built on top of Mapbox GL (v1.13.2) that powers Woosmap's location intelligence platform. It uses Flow for type annotations and Preact as its React-compatible UI layer.
Features
- Interactive vector maps with WebGL rendering
- Indoor mapping and wayfinding
- Drawing tools (polygons, lines, points)
- UI widgets (navigation controls, indoor panel)
- GeoJSON data layer with feature styling
- Custom map styling via
MapStyleSpec - Tile overlays via
ImageMapType - Observable property binding (MVCObject pattern)
Quick Start
Include the SDK via script tag:
<script src="https://sdk.woosmap.com/map/map.js?key=YOUR_API_KEY&callback=initMap"></script>
Create a map:
function initMap() {
var map = new woosmap.map.Map(document.getElementById("map"), {
center: {lat: 48.8566, lng: 2.3522},
zoom: 13,
});
}
Core API
| Class | Description |
|---|---|
Map |
Main map instance, extends MVCObject |
Marker |
Map marker with position and icon |
InfoWindow |
Popup attached to a position or marker |
OverlayView |
Base class for custom overlays |
Polygon, Polyline, Circle, Rectangle |
Geometry shapes |
Data |
GeoJSON data layer |
StoresOverlay |
Point cluster overlay for stores |
DatasetsOverlay |
Point cluster overlay for datasets |
ImageMapType |
Custom tile layer overlay |
MVCObject |
Observable property binding base class |
MVCArray |
Observable array |
DirectionsRenderer |
Renders direction routes on the map |
Services
All services are available in both the main map.js bundle and the headless services.js bundle.
| Service | Description |
|---|---|
DirectionsService |
Route calculation between origin/destination |
DistanceService |
Distance matrix and isochrone calculations |
StoresService |
Store search, autocomplete, and bounds |
LocalitiesService |
Address autocomplete and geocoding |
DatasetsService |
Dataset querying |
TransitService |
Public transit routing |
Bundles
The library ships as 4 independent IIFE bundles:
| Bundle | Content |
|---|---|
map.js |
Maps + Indoor (main bundle) |
widgets.js |
UI widgets (navigation, indoor panel) |
drawing.js |
Drawing tools |
services.js |
API services only (no map rendering) |
All bundles export to window.woosmap.map. The services bundle is a lightweight alternative when you only need API access without map rendering.
Global Namespace
// Primary namespace
window.woosmap.map.Map
window.woosmap.map.Marker
window.woosmap.map.DirectionsService
// Legacy namespace (deprecated)
window.ninja.maps