TomTom Maps for JavaScript
    Preparing search index...

    Variable locatePlaceConst

    locatePlace: (
        query: string,
        queryAs: QueryAs,
        bias?: GeoBias,
        execOptions?: ToolExecuteOptions,
    ) => Promise<Place | null>

    Finds the best match for a query as the locatePlace tool does, for a custom tool that needs one place. A failed or cancelled request rejects, so catch it in execute.

    Type Declaration

      • (
            query: string,
            queryAs: QueryAs,
            bias?: GeoBias,
            execOptions?: ToolExecuteOptions,
        ): Promise<Place | null>
      • Parameters

        • query: string
        • queryAs: QueryAs
        • Optionalbias: GeoBias

          Favours results near a position, such as the map centre from getViewportBias.

        • OptionalexecOptions: ToolExecuteOptions

          The execute options, whose signal cancels the request with the turn.

        Returns Promise<Place | null>

        The first match, or null when nothing matches.

    execute: async ({ name }, state, options) => {
    const position = getViewportBias(state.baseMap);
    const place = await locatePlace(name, 'poi', position && { position }, options);
    // ...
    },