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

    Type Alias Routes<P, FeatureCollectionProps>

    Routes: Omit<
        FeatureCollectionWithProperties<LineString, P, FeatureCollectionProps>,
        "features" | "bbox",
    > & { bbox?: BBox; features: Route<P>[] }

    A GeoJSON FeatureCollection of one or more calculated routes.

    It typically holds the main route (index 0) and optional alternative routes. Its properties can include metadata about the routing request.

    Type Parameters

    • P extends RouteProps = RouteProps

      Type of individual route properties (defaults to RouteProps)

    • FeatureCollectionProps = unknown

      Type of collection-level properties

    Type Declaration

    • Optionalbbox?: BBox

      The bounding box of all the routes, or at least of their waypoints. It is defined only if there are routes.

    • features: Route<P>[]

      The route features.

    const routes: Routes = {
    type: 'FeatureCollection',
    features: [
    { type: 'Feature', geometry: {...}, properties: { index: 0, ... } }, // Main route
    { type: 'Feature', geometry: {...}, properties: { index: 1, ... } } // Alternative
    ],
    properties: {
    requestId: 'req-456',
    calculatedAt: new Date()
    }
    };