This is the documentation of version 1.0.0-rc.4. Go to the latest version, 1.0.0-rc.5.

Route planning parameters

calculateRoute takes these options besides its locations. All are optional, with the defaults given below.

Locations

locations is the only required parameter. It holds the ordered waypoints and paths the route passes through. Locations covers every accepted form.

import { calculateRoute } from '@tomtom-org/maps-sdk/services';

const routes = await calculateRoute({
    locations: [
        [4.9041, 52.3676], // Amsterdam
        [2.3522, 48.8566]  // Paris
    ]
});

Alternative routes

maxAlternatives – 0 (default) to 5 alternatives on top of the best route, which always comes first.

const routes = await calculateRoute({
    locations: [[4.9041, 52.3676], [2.3522, 48.8566]],
    maxAlternatives: 2 // up to 3 routes in total
});

Cost model

costModel decides which path wins.

routeType – What the route is optimised for:

traffic – Which traffic the route plans around:

avoid – What the route tries to avoid (nothing by default). If no other route exists, avoidance is not guaranteed:

avoidAreas – Up to 10 rectangles to bypass, each a bounding box [west, south, east, north] or any GeoJSON whose bounding box is the rectangle:

const routes = await calculateRoute({
    locations: [[4.9041, 52.3676], [2.3522, 48.8566]],
    costModel: {
        routeType: 'efficient',
        traffic: 'historical',
        avoid: ['motorways', 'ferries'],
        avoidAreas: [[2.265938, 48.81851, 2.41115, 48.90309]] // around Paris
    }
});

A single leg can override routeType and avoid. See Per-stop options.

Departure and arrival time

when – Depart at, or arrive by, a given time (default: depart now). A past or unreachable time falls back to departing now. The response carries both times as summary.departureTime and summary.arrivalTime.

Give the time in one of two ways:

localDateTime is a wall-clock time without an offset, read in the origin's time zone. With arriveBy, it's read in the time zone of the route's destination instead. So your app needs no time zone table, wherever it runs. To leave Amsterdam at 9am and to reach Paris by 5pm Paris time:

const departing = await calculateRoute({
    locations: [[4.9041, 52.3676], [2.3522, 48.8566]],
    when: { option: 'departAt', localDateTime: '2026-12-24T09:00:00' }
});

const arriving = await calculateRoute({
    locations: [[4.9041, 52.3676], [2.3522, 48.8566]],
    when: { option: 'arriveBy', localDateTime: '2026-12-24T17:00:00' }
});

In TypeScript, a localDateTime you build at runtime needs as LocalDateTime, with each field padded to two digits. Request validation still checks the format at the call, and rejects a date that doesn't exist, such as 2026-02-30.

To depart at a moment you already hold, such as one a user picked in their own time zone, pass it as date instead.

The demo below plans one trip for eight departures across the next weekday, in parallel. Pick a departure to draw its route.

Vehicle configuration

vehicle – Weight, heading and restrictions, all listed in Vehicle configuration.

const routes = await calculateRoute({
    locations: [[4.9041, 52.3676], [2.3522, 48.8566]],
    vehicle: { model: { dimensions: { weightKG: 3500 } } }
});

Turn-by-turn guidance

guidance: { type: 'coded' } adds instructions to each route. See Guidance.

Route sections

sectionTypes – Which sections the response carries. By default, it requests defaultSectionTypes: every type but curve and curvyStretch. A list narrows the response to those types, and [] asks for none.

Section type Requested
carpool, carTrain, country, ferry, importantRoadStretch, lowEmissionZone, motorway, pedestrian, roadShields, speedLimit, toll, tollRoad, tollVignette, traffic, tunnel, unpaved, urban, vehicleRestricted Through sectionTypes
curve, curvyStretch Only through a sectionTypes list that names them. The SDK finds them in the route's geometry rather than asking the routing API
lanes Only with guidance, and through sectionTypes when a list is given
leg Always
distinct Always, when the response has two or more routes
const routes = await calculateRoute({
    locations: [[4.9041, 52.3676], [2.3522, 48.8566]],
    sectionTypes: ['toll', 'ferry', 'traffic', 'motorway', 'country']
});

To add types to the default rather than narrow it, spread defaultSectionTypes from core into the list:

import { defaultSectionTypes } from '@tomtom-org/maps-sdk/core';

const routes = await calculateRoute({
    locations: [[4.9041, 52.3676], [2.3522, 48.8566]],
    sectionTypes: [...defaultSectionTypes, 'curve', 'curvyStretch']
});

curveDetection – The thresholds the SDK finds curve and curvyStretch with. See Choose what counts as a curve.

Extended route information

extendedRouteRepresentations – Cumulative distance and travel time at points along the route, in the route's progress property (default ['distance', 'travelTime']).

const routes = await calculateRoute({
    locations: [[4.9041, 52.3676], [2.3522, 48.8566]],
    extendedRouteRepresentations: [] // no progress data
});

Traffic-based travel times

computeTravelTimeFor – 'none' (default), or 'all' for three more travel times in the summary, to show what traffic costs or what leaving now saves:

const routes = await calculateRoute({
    locations: [[4.9041, 52.3676], [2.3522, 48.8566]],
    computeTravelTimeFor: 'all'
});

To show the delay against free flow from these times, see the route summary.

Per-stop options

Any waypoint feature carries its own options in properties, typed with RouteStopOptions. They describe the leg arriving at that stop and the wait there, so if you insert an earlier stop, they stay attached to the right place.

const routes = await calculateRoute({
    locations: [
        [2.1734, 41.3851],
        {
            type: 'Feature',
            geometry: { type: 'Point', coordinates: [2.4467, 41.5381] },
            properties: {
                pauseDurationSeconds: 1800,
                legCostModel: { routeType: 'short', avoid: ['motorways'] }
            }
        },
        [2.8214, 41.9794]
    ]
});

const legs = routes.features[0].properties.sections.leg;
legs[0].summary.stopTimeInSeconds;   // the whole time at the first stop
legs[0].summary.travelTimeInSeconds; // driving only

The wait comes back as the arriving leg's stopTimeInSeconds. Leg travel times are driving only, while the route's travel time includes every stop. What the routing SDK adds explains both.

In the demo below, each leg of a four-stop route takes its own route type and avoid list, and the panel shows the distance, driving time and wait each leg comes back with.

Arrival side

arrivalSide – Which side of the road to arrive on, at the destination and every intermediate stop, as one of the importable arrivalSides:

const routes = await calculateRoute({
    locations: [[4.9041, 52.3676], [2.3522, 48.8566]],
    arrivalSide: 'curb'
});

Entry points

useEntryPoints – Where a place waypoint with entry points is routed to:

const routes = await calculateRoute({
    locations: [origin, destinationPlace],
    useEntryPoints: 'main-when-available'
});

For a stop with several usable entrances, candidateEntryPoints hands the alternatives to the routing engine instead of resolving one position client-side.

A parameter the endpoint cannot accept

calculateRoute() and calculateReachableRange() call two endpoints that do not accept the same parameters. The SDK never drops one silently. It either:

A request that dropped an input would still return a route with plausible numbers, computed from something other than what you asked for.

API reference

Related guides and examples

Related guides

Related examples