This is the documentation of version 1.0.0-rc.1. 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',
    date: new Date('2025-10-20T08:00:00Z')
    }
    };

    // 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.

    Note that the requested travelMode may not be available for the entire route. Where it is not available for a particular section, the response element for that section is 'other'.

    None
    

    The parameters of the vehicle that drives the route.

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

    depart now