TomTom Maps for JavaScript
    Preparing search index...

    Function discoverOnePlace

    • Searches for a single place by text query.

      It calls discoverPlaces and returns the first result. It throws an error if no results are found.

      Parameters

      • queryOrParams: string | Omit<FuzzySearchParams, "limit">

        The search query, or the full FuzzySearchParams without limit. Pass the params form to set any other option, signal included.

      Returns Promise<Place<SearchPlaceProps>>

      The first matching place.

      With the code NOT_FOUND and the service 'FuzzySearch' if no results are found for the query

      const place = await discoverOnePlace('Vondelpark Amsterdam');
      console.log(place.properties.poi?.name);

      const nearby = await discoverOnePlace({ query: 'coffee', geoBias: { position: [4.9041, 52.3676] }, signal });

      Use it to quickly find a single place, particularly a POI. To find a single address, consider geocodeOne.