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 AlongRoutePlaceProps

    AlongRoutePlaceProps: SearchPlaceProps & {
        detourDistanceInMeters: number;
        detourOffsetInMeters?: number;
        detourTimeInSeconds: number;
    }

    The properties of a place that discoverPlaces finds along a route: the search properties plus the detour a stop at the place costs.

    Type Declaration

    • detourDistanceInMeters: number

      Meters a stop at the place adds to the route, negative when the route through it is shorter.

    • OptionaldetourOffsetInMeters?: number

      Meters from the start of the route to where the detour to the place leaves it.

      It is present only when you sort by 'detourOffset', which types it as required.

    • detourTimeInSeconds: number

      Seconds a stop at the place adds to the route, negative when the route through it is faster.

    A detour is measured against the original route, so either figure can be negative.

    const cafes = await discoverPlaces({ route, maxDetourTimeSeconds: 600, query: 'cafe' });
    const minutes = Math.round(cafes.features[0].properties.detourTimeInSeconds / 60);