TomTom Maps for JavaScript
    Preparing search index...

    Function placeById

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

      The Place by ID service fetches comprehensive data for a specific place when you have its ID from a previous search or from a place's dataSources. This is useful for getting additional details or refreshing information about a known location.

      Parameters

      • params: PlaceByIdParams

        Place by ID parameters with the place identifier

      • OptionalcustomTemplate: Partial<PlaceByIdTemplate>

        Advanced customization for request/response handling

      Returns Promise<PlaceByIdResponse>

      Promise resolving to detailed place information

      Use cases:

      • Fetch POI details: Get extended information like reviews, photos, amenities
      • Refresh place data: Update information for a cached place
      • Deep linking: Allow users to share/bookmark specific places
      • Related POI navigation: Explore parent/child relationships

      The ID can be obtained from:

      // Get place by ID from search result
      const searchResult = await search({ query: 'Eiffel Tower' });
      const placeId = searchResult.features[0].id;

      const placeDetails = await placeById({
      key: 'your-api-key',
      entityId: placeId
      });

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

      if (poiDetailsId) {
      const detailedPOI = await placeById({
      key: 'your-api-key',
      entityId: poiDetailsId
      });
      // May include additional photos, reviews, extended hours, etc.
      }

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