TomTom Maps for JavaScript
    Preparing search index...

    Function getPlaceDetails

    • Retrieves detailed information about a place using its unique identifier.

      The place details service fetches comprehensive data for a specific place when you have its ID from a previous search or from a place's dataSources. Use it to get additional details or refresh information about a known location.

      Parameters

      Returns Promise<PlaceDetailsResponse>

      The detailed place information, or undefined when the ID matches nothing.

      Use it to fetch a POI's opening hours, related POIs and EV charging hardware, update the information of a cached place, let users share or bookmark specific places through deep links, or explore parent/child relationships between related POIs.

      You can get the ID from:

      // Get a search result's full details
      const searchResult = await discoverPlaces({ query: 'Eiffel Tower' });
      const placeId = searchResult.features[0].id;

      const placeDetails = await getPlaceDetails({
      entityId: placeId
      });

      // Get extended POI details
      const place = searchResult.features[0];
      const poiDetailsId = place.properties.dataSources?.poiDetails?.id;

      if (poiDetailsId) {
      const detailedPOI = await getPlaceDetails({
      entityId: poiDetailsId,
      openingHours: 'nextSevenDays'
      });
      }

      // Navigate to related POI
      const relatedPOI = place.properties.relatedPois?.[0];
      if (relatedPOI) {
      const parentPlace = await getPlaceDetails({
      entityId: relatedPOI.id
      });
      if (parentPlace) console.log('Parent location:', parentPlace.properties.address);
      }