TomTom Maps for JavaScript
    Preparing search index...

    Function searchOne

    • Search for a single place by text query.

      Convenience function that calls search and returns the first result. Throws an error if no results are found.

      Parameters

      • query: string

        Search query string

      Returns Promise<Place<SearchPlaceProps>>

      Promise resolving to the first matching place

      If no results are found for the query

      const place = await searchOne('Vondelpark Amsterdam');
      console.log(place.properties.poi?.name);
      • Useful to quickly find a single place, particularly a POI.
      • If you want to find a single address, consider 'geocodeOne'.