This is the documentation of version 0.63.0. Go to the latest version, 1.0.0-rc.5.
TomTom Maps for JavaScript
    Preparing search index...

    Function getPlaceWithEVAvailability

    • Enhance a place with real-time EV charging availability data.

      Fetches availability information for an EV charging station and merges it into the place properties.

      Type Parameters

      Parameters

      • place: Place<P>

        The place to enhance with availability data

      • OptionalcommonParams: Omit<ChargingStationsAvailabilityParams, "id">

        Common service parameters (e.g. apiKey, onAPIRequest, signal) forwarded to the availability request

      Returns Promise<Place<EVChargingStationWithAvailabilityPlaceProps> | undefined>

      Promise resolving to the place with merged availability information

      Needs the same API key access as evChargingStationsAvailability. A failed request, including one from a key without that access, is logged and resolves to undefined. A cancellation is the caller's own decision rather than a data gap, so it rejects the call instead.

      SDKAbortError when commonParams.signal is aborted

      // After search, enhance place with availability
      const searchResult = await discoverPlaces({ query: 'EV charging', ... });
      const place = searchResult.features[0];

      const enhancedPlace = await getPlaceWithEVAvailability(place);
      if (enhancedPlace) {
      const { count, statusCounts } = enhancedPlace.properties.chargingPark.availability.chargingPointAvailability;
      console.log(`${statusCounts.Available ?? 0} of ${count} chargers available`);
      }