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

    Type Alias RoutingModuleConfig

    RoutingModuleConfig: MapModuleCommonConfig & {
        beforeLayerConfig?: RoutingBeforeLayerConfig;
        chargingStops?: ChargingStopsConfig;
        color?: string;
        countryCrossings?: CountryCrossingConfig;
        displayUnits?: DisplayUnits;
        highlight?: RouteHighlightConfig;
        layers?: RouteLayersConfig;
        sections?: SectionsDisplayConfig;
        summaryBubbles?: { visible?: boolean };
        visible?: boolean;
        waypoints?: WaypointsConfig;
        waypointSize?: RouteWaypointSize;
        waypointSizeFactor?: number;
        width?: RouteWidth;
        widthFactor?: number;
    }

    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.

      Left out, every layer sits where RoutingBeforeLayerConfig says it does by default.

    • OptionalchargingStops?: ChargingStopsConfig

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

      Controls how charging stops source data and/or layer configs are processed to rendering them the map.

    • 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), else the SDK's own route blue. layers overrides it layer by layer.

    • OptionalcountryCrossings?: CountryCrossingConfig

      Appearance of the border crossings along the route.

      Read off 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.

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

      the global configuration's displayUnits

    • Optionalhighlight?: RouteHighlightConfig

      How a hovered or clicked route is drawn.

    • Optionallayers?: RouteLayersConfig

      Custom layer styling configuration.

      • Overrides the default layer styling with custom specifications.
      • You must provide complete layer specifications for any layers you wish to customize.
      • You can still reuse the default configurations if you want incremental changes. See: defaultRoutingLayers.
      • Any layer not specified will continue to use its default styling.
      • Use this only if you need fine MapLibre control on how some parts of the route are displayed.
    • Optionalsections?: SectionsDisplayConfig

      Appearance of the route sections, keyed by section type.

      Covers every section type the module draws, on the same knobs: draw it or not, its colour, opacity, width, whether it bands the route or stands in for its line, its line pattern and its icon.

      The types whose stretches are sparse and consequential draw themselves — carTrain, ferry, lowEmissionZone, tollRoad, tollVignette, traffic, tunnel and vehicleRestricted — and switch off with { visible: false }. The rest switch on with { visible: true }: a type covering most of a route buries the route line.

      layers.sections takes full MapLibre layer specs for the same types, for anything these knobs cannot express.

    • OptionalsummaryBubbles?: { visible?: boolean }

      Configuration for the route summary bubbles displayed on the map.

      Summary bubbles show key route information (distance, duration, traffic delay) as visual overlays positioned along the route.

      • Optionalvisible?: boolean

        Controls the visibility of route summary bubbles on the map.

        true
        
    • Optionalvisible?: boolean

      Whether the module draws anything: route lines, waypoints, sections, guidance, charging stops, 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.

      Controls how waypoint source data and/or layer configs are processed to rendering them the map.

    • OptionalwaypointSize?: RouteWaypointSize

      Size preset of the waypoint pins.

      "m"

    • OptionalwaypointSizeFactor?: number

      Multiplier over the waypointSize preset, 1 leaving it unchanged; the two compose.

      Clamped to ROUTE_WAYPOINT_SIZE_FACTOR_RANGE, 0.5 to 2.

      1

    • Optionalwidth?: RouteWidth

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

      "m"

    • OptionalwidthFactor?: number

      Multiplier over the width preset, 1 leaving it unchanged; the two compose, so { width: 'l', widthFactor: 1.5 } draws 1.5 × the "l" profile.

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

      1

    Provides customization options for route visualization and behavior, including display units, waypoint handling, and layer styling.

    RoutingModuleSerializableConfig for the part that survives JSON.