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 CommonRoutingParams

    The parameters every routing service request shares.

    They configure how routes are calculated, including optimisation strategy, vehicle characteristics, timing constraints, and travel preferences, with one interface across the routing services.

    Both routing services (calculateRoute, calculateReachableRange) accept them to customise route calculation. They control:

    • What to optimize for (time, distance, fuel)
    • Vehicle constraints and capabilities
    • When to travel (affecting traffic)
    • What features to avoid
    • Mode of transportation

    calculateRoute supports all of them, and calculateReachableRange a subset.

    // Standard car route avoiding tolls
    const routingParams: CommonRoutingParams = {
    costModel: {
    routeType: 'fast',
    traffic: 'live',
    avoid: ['tollRoads']
    },
    travelMode: 'car',
    when: {
    option: 'departAt',
    localDateTime: '2026-10-19T08:00:00'
    }
    };

    // Heavy, speed-limited vehicle, described by weight alone (see `VehicleDimensions`)
    const heavyVehicleParams: CommonRoutingParams = {
    costModel: {
    routeType: 'short',
    avoid: ['tollRoads', 'ferries']
    },
    vehicle: {
    model: {
    dimensions: {
    weightKG: 40000
    }
    },
    restrictions: {
    maxSpeedKMH: 90
    }
    }
    };
    type CommonRoutingParams = {
        costModel?: CostModel;
        travelMode?: TravelMode;
        vehicle?: VehicleParameters;
        when?: DepartArriveParams;
    }
    Index
    costModel?: CostModel

    The criteria for which paths to prefer during routing.

    travelMode?: TravelMode

    The travel mode for the requested route, which is the primary means of transport while routing.

    Only 'car' is supported, which is also the routing service's default. For calculateRoute, the parts of the route a car may not use come back as its vehicleRestricted sections, unless sectionTypes leaves them out.

    'car'
    

    The parameters of the vehicle that drives the route.

    When to depart or arrive, as an instant or a wall-clock time. If you pass a past time, or one that is impossible to achieve (such as an imminent arrival for a long route), it defaults to departing now.

    depart now