This is the documentation of version 1.0.0-rc.4. Go to the latest version, 1.0.0-rc.5.
TomTom Maps for JavaScript
    Preparing search index...

    Type Alias RoutingModuleConfig

    RoutingModuleConfig: MapModuleCommonConfig & {
        beforeLayerConfig?: RoutingBeforeLayerConfig;
        color?: string;
        countryCrossings?: CountryCrossingConfig;
        displayUnits?: DisplayUnits;
        highlight?: RouteHighlightConfig;
        layers?: RouteLayersConfig;
        opacity?: number;
        sections?: SectionsDisplayConfig;
        summaryBubbles?: SummaryBubblesConfig;
        visible?: boolean;
        waypoints?: WaypointsConfig;
        widthFactor?: number;
        widthPreset?: RouteWidth;
    }

    Configuration options for the routing module.

    Type Declaration

    • OptionalbeforeLayerConfig?: RoutingBeforeLayerConfig

      Where the route's layers sit in the map's layer stack, for the whole route or per part.

      If you leave it out, every layer sits where RoutingBeforeLayerConfig says it does by default.

    • Optionalcolor?: string

      The colour of the route line, its outline and the waypoint icons, as any CSS colour string.

      The outline takes a darker shade of it. When unset, the map's accent colour applies if a theme sets one (TomTomMap.mapColors), otherwise the SDK's own route blue. layers overrides it layer by layer.

    • OptionalcountryCrossings?: CountryCrossingConfig

      Appearance of the border crossings along the route.

      They come from the route's country sections, so a route carrying none draws none.

    • OptionaldisplayUnits?: DisplayUnits

      Units of the distances and durations the module writes on the map.

      They apply over the global configuration's display units field by field, and a field left unset keeps the global value. distance.type picks the unit system (metric, imperial_us or imperial_uk), and the other fields relabel the units.

      the global configuration's displayUnits

    • Optionalhighlight?: RouteHighlightConfig

      How a hovered or clicked route is drawn.

    • Optionallayers?: RouteLayersConfig

      MapLibre overrides for the route's layers, for what the other settings can't express.

      Each entry is a partial layer spec merged onto the layer the module builds from the rest of this configuration. Top-level fields replace, and paint and layout merge per property, so set only what you change. Any layer you don't name keeps its look.

      Don't copy values from defaultRoutingLayers into an entry. They come from the default configuration, so they write the default line-width over the one widthPreset and widthFactor computed, and the same for every other setting.

    • Optionalopacity?: number

      Opacity of the route lines and their outlines, selected and deselected, from 0 to 1.

      Lower it to keep what the map draws under a route readable, such as traffic flow. Sections keep their own sections.<type>.opacity, and the waypoints and summary bubbles stay opaque.

      1

    • Optionalsections?: SectionsDisplayConfig

      Appearance of the route sections, keyed by section type.

      It covers every section type the module draws: draw it or not, its colour, opacity, width, whether it bands the route or stands in for its line, its line pattern, its icon and its sign. A type takes only the knobs it can honour, so traffic has no colour, pattern or icon.

      Some types draw themselves and the rest only when you switch them on, as SectionDisplayConfig.visible lists.

      layers.sections takes MapLibre overrides for the same types, for anything these knobs cannot express.

    • OptionalsummaryBubbles?: SummaryBubblesConfig

      The route summary bubbles on the map.

      A summary bubble shows key route information (duration, distance, traffic delay) as a visual overlay along the route.

    • Optionalvisible?: boolean

      Whether the module draws anything: route lines, waypoints, sections, guidance, summary bubbles and border crossings.

      showRoutes(), showWaypoints() and the clear methods never change it. A hidden module keeps its data until RoutingModule.setVisible shows it again. While shown, each part's own visible (sections.<type>.visible, summaryBubbles.visible, …) still decides whether it draws.

      true
      
    • Optionalwaypoints?: WaypointsConfig

      Configuration for the waypoints source and layers to display them on the map.

      It controls how waypoint source data and layer configs are processed to render them on the map.

    • OptionalwidthFactor?: number

      Multiplier over the widthPreset, where 1 leaves it unchanged. The two compose, so { widthPreset: 'l', widthFactor: 1.5 } draws 1.5 × the "l" profile.

      Clamped to 0.5 to 2, its range in routingKnobCatalogue. Sections without a widthFactor of their own follow it, and so do the instruction arrows, which no preset resizes.

      1

    • OptionalwidthPreset?: RouteWidth

      Thickness preset of the route line and its outline, which the section and instruction lines follow.

      "m"

    It customises how routes look and behave, including display units, waypoint handling and layer styling.

    RoutingModuleSerializableConfig for the part that survives JSON.