Map
bk-map: Leaflet map with optional OSRM routing (route, nearest, table, match, trip, tile). Each section below is a separate variant for team review. Configure the OSRM server via BK_OSRM_CONFIG.
Preview
A working preview of Map in the Brickclay style. Try it.
1. Basic markers (status colors)
Built-in status: default, success, info, warning, inactive, invalid.
2. Custom marker images
Pass iconUrl (+ optional iconSize / iconAnchor) for a custom house/building pin.
3. Fleet + legend + cluster + fullscreen
Header hides in fullscreen; use the floating Exit control to leave.
4. OSRM route
[routeRequest] with waypoints A→B→C (Berlin public demo server).
Route: 4,733 m / 631 s
5. OSRM nearest
Snaps a coordinate to the road network via BkOsrmService.nearest().
6. OSRM table
Duration matrix between three points via BkOsrmService.table().
7. OSRM match
Map-matching a GPS-like trace with [matchTrace].
Match: 1,390 m · confidence 0
8. OSRM trip (TSP)
Optimized tour via [tripStops] (roundtrip from first stop).
Trip: 7,997 m / 958 s
9. Location picker + lat / long fields
Click the map or drag the pin, updates the fields. Edit fields and click Apply to move the pin.
10. Loading
Host-controlled [loading] shows a spinner in the header (hidden in fullscreen).
Event log
- [08:31:36] tripLoaded → 7996.6 m, 958 s
- [08:31:36] matchLoaded → 1389.9 m, 244 s
- [08:31:36] routeLoaded → 4733.2 m, 631 s
11. API reference
| Input / output | Type | Default | Description |
|---|---|---|---|
markers | BkMapMarker[] | [] | Pins (id, lat, lng, tooltip, status, iconUrl, iconSize, iconAnchor, draggable). |
routeRequest / routes | BkMapRoute | null / [] | OSRM waypoints or precomputed latlngs. |
matchTrace | BkMapMatchTrace | null | GPS points → map-matching. |
tripStops | BkMapTripStops | null | TSP optimized tour. |
enableLocationPicker | boolean | false | Click / drag to pick lat/long. |
cluster | boolean | false | Uses leaflet.markercluster when installed. |
showFullscreen | boolean | false | Header button; header hidden while fullscreen (floating Exit). |
showLegend / legendItems | boolean / array | false | Bottom legend overlay. |
loading | boolean | false | Header spinner (host-controlled). |
locationSelected | output | – | { latitude, longitude, lat, lng }. |
routeLoaded | output | – | Typed OSRM Route. |
error | output | – | OSRM code + message. |
mapReady | output | – | Raw L.Map escape hatch. |
BkOsrmService | injectable | – | route, nearest, table, match, trip, tile. |