TomTom Maps for JavaScript
    Preparing search index...

    Type Alias PlaceConnectionDisplay

    A single connection between two places, rendered as a line on the map.

    You can give each endpoint as a full Place object or as the id of a place the PlacesModule currently shows (via show()). The module resolves an id against its currently shown places to get the coordinates. It silently skips connections that reference unknown ids.

    An id resolves each time the connections are drawn, which happens on showConnections(), a configuration change and a style change. show() and clear() drop every connection, so none outlives the places it referred to, and none comes back when those places are shown again.

    The connection keeps any extra properties and passes them to the optional label function, so you can render metadata such as distance or travel time along the line.

    const connection: PlaceConnectionDisplay = {
    from: stationPlace, // full Place object
    to: 'cafe-id-123', // or a shown place's id
    distanceMeters: 420 // extra metadata available to the label function
    };
    type PlaceConnectionDisplay = {
        from: Place | string;
        id?: string;
        to: Place | string;
        [key: string]: unknown;
    }

    Indexable

    • [key: string]: unknown

      Arbitrary extra metadata, preserved on the connection and passed to the label function.

    Index
    from: Place | string

    The first endpoint of the connection, as a Place object or the id of a place the module currently shows.

    id?: string

    A stable id for this connection, generated if omitted.

    to: Place | string

    The second endpoint of the connection, as a Place object or the id of a place the module currently shows.