Styling the Route
Applying and overriding wayfinding route styling with DirectionsRenderer in the MapsIndoors web SDK.
The DirectionsRenderer decides how a calculated route looks on the map — the line itself, its animation, the direction arrows drawn along it, the markers at each stop and floor change, and the markers at the start and end.
Every route always has a style. Values are resolved in three layers, each overriding the one before it:
Built-in defaults — the SDK's baseline look (a solid blue line, 4 px wide, with a flowing animation).
Solution styling — configured in the CMS under Solution Settings → Directions Renderer. Every app on the Solution picks it up automatically, with no code.
Runtime options — anything you pass to the renderer in code, which sits on top of the CMS configuration and resets when the app reloads.
So the recommended path is to style once in the CMS and let it flow to every app. Use the runtime options below only when you need to override the Solution styling for a specific app or moment.
Setting options in code
Pass styling options when you construct the renderer, or later with setOptions():
const directionsRenderer = new mapsindoors.directions.DirectionsRenderer({
mapsIndoors: mapsIndoorsInstance,
strokeColor: '#3071D9',
strokeWeight: 6,
stamp: { preset: 'arrow', arrowStyle: 'chevronDouble', color: '#FFFFFF' }
});
// …later, override just the arrow color — every other field is kept:
directionsRenderer.setOptions({ stamp: { color: '#FF0000' } });Grouped options — halo, stamp, legBoundaryIcons, startDisplayRule, endDisplayRule, and elevation — merge field by field. In the example above, setOptions changes only stamp.color; the preset and arrowStyle set at construction are preserved. To revert a whole group back to its construction baseline, pass undefined for it. To turn the route animation off entirely, pass animation: null.
Options reference
mapsIndoors
MapsIndoors
—
Required. The MapsIndoors instance.
strokeColor
string
'#3071D9'
Route line color.
strokeOpacity
number
1
0–1.
strokeWeight
number
4
Line width in pixels.
strokeStyle
string
'solid'
'solid', 'dashed', or 'dotted'. See engine support below.
halo
object
(CMS)
{ enabled, color, weight, opacity }. Merges field by field.
animation
object | null
(default animation)
The route animation controller, or null to disable. Tune it via Customizing the Route Animation.
legBoundaryIcons
object
(CMS)
Floor-change (connector) icons per type, plus a shared scale. Applied on the next route.
startDisplayRule
object
(CMS)
Start (origin) marker: { icon, label, zoom range, … }. Merges field by field.
endDisplayRule
object
(CMS)
End (destination) marker, as above.
elevation
object
(CMS)
{ elevated, heightMeters }. See engine support below.
fitBounds
boolean
true
Fit the viewport to the route.
fitBoundsPadding
number | object
—
Padding when fitting the viewport.
fitBoundsMaxZoom
number
(CMS)
Caps how far the map zooms in when fitting a route (1–24).
visible
boolean
true
Initial visibility of the route.
Direction arrows
The stamp option repeats a small marker along the route line to reinforce the direction of travel:
preset
string
'none'
'none' (no stamp) or 'arrow' (built-in arrow).
arrowStyle
string
'chevron'
'chevron', 'chevronDouble', 'triangle', 'arrow' (CMS: "Line arrow"), or 'dart' (CMS: "Navigation dart"). Applies when preset is 'arrow'.
color
string
'#FFFFFF'
Tint for the built-in arrow.
iconUrl
string | null
null
A custom icon repeated along the line — use a Media-Library URL (an absolute https URL).
spacingPx
number
24
Distance between stamps, in pixels (8–200).
scale
number
1
Size multiplier on the base 24 px icon (0.2–4).
A custom iconUrl always wins over the arrow preset: when iconUrl is set, the custom icon is drawn instead of the built-in arrow. Set iconUrl back to null to return to the arrow. (On Google Maps a custom icon can't render, so it falls back to the built-in arrow — see Engine support.)
Other styling
Halo —
halo: { enabled, color, weight, opacity }draws a contrasting outline beneath the line so it stays readable over busy floor plans. Off by default; when on, the halo width is added to each side, so the total width is the line weight plus twice the halo weight.Animation — a moving overlay that shows direction of travel, configured on the animation controller via
directionsRenderer.getAnimation().setOptions({ … }). Choose thetype('flow'(default),'pulse','comet', or'none'), thespeed(in screen pixels per second, so it reads the same at every zoom), a minimum duration per leg, and the overlay's own colour/width/opacity. SetforceAnimation: trueto keep it running when the device requests reduced motion — for kiosks and signage. See Customizing the Route Animation for more on the animation controller.Stop, connector, and terminus markers — icons at each stop, at floor changes (
legBoundaryIcons), and at the start/end (startDisplayRule/endDisplayRule). Every route-styling icon renders at a fixed 24 px base multiplied by itsscale, so sizes stay consistent across map engines.
3D elevated line —
elevation: { elevated: true, heightMeters: 10 }lifts the route off the floor in a tilted view.
Engine support
The five arrow styles, line/halo/opacity, animation, stop icons, connector icons, start/end markers, and the camera cap all render on both Mapbox and Google Maps. A few features are Mapbox-only or approximated on Google:
Line, halo, animation, arrows, markers, camera
✅
✅
Dashed / dotted line
✅ (Mapbox GL JS v3)
⚠️ approximated with spaced dots; dashes can overshoot sharp corners
Custom stamp iconUrl
✅
❌ falls back to the built-in arrow
3D elevated line
✅ (Mapbox GL JS v3)
❌ renders flat
See all available directions render options in the reference documentation.
For configuring the same styling without code — so it applies to every app on the Solution — see Solution Settings → Directions Renderer in the CMS.
Last updated
Was this helpful?