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

    Function getPlacesWithEVAvailability

    • Enhance multiple places with real-time EV charging availability data.

      Fetches availability information for all EV charging stations in a collection and merges it into their properties. Non-EV places and EV stations without availability data are returned unchanged.

      Type Parameters

      Parameters

      • places: Places<P>

        Collection of places to enhance

      • Optionaloptions: Omit<ChargingStationsAvailabilityParams, "id"> & {
            excludeIfAvailabilityUnknown: true;
        }

        Configuration options, including common service parameters (e.g. key, customServiceBaseURL, onAPIRequest) forwarded to each availability request

      Returns Promise<Places<EVChargingStationWithAvailabilityPlaceProps>>

      Promise resolving to places collection with merged availability

      Important: Availability requests are made sequentially to avoid exceeding API rate limits (QPS - Queries Per Second). For large result sets, this may take some time.

      Needs the same API key access as evChargingStationsAvailability. A place whose request fails, including for a key without that access, counts as having unknown availability.

      // Search for charging stations and add availability
      const results = await discoverPlaces({
      query: 'EV charging',
      at: [4.9, 52.3],
      radius: 5000
      });

      const withAvailability = await getPlacesWithEVAvailability(results, {
      excludeIfAvailabilityUnknown: true // Filter out stations with unknown availability
      });

      // Display only stations with known availability
      withAvailability.features.forEach(place => {
      const available = place.properties.chargingPark?.availability?.chargingPointAvailability.count;
      console.log(`${place.properties.poi?.name}: ${available} chargers`);
      });
    • Enhance multiple places with real-time EV charging availability data.

      Fetches availability information for all EV charging stations in a collection and merges it into their properties. Non-EV places and EV stations without availability data are returned unchanged.

      Type Parameters

      Parameters

      • places: Places<P>

        Collection of places to enhance

      • Optionaloptions: Omit<ChargingStationsAvailabilityParams, "id"> & {
            excludeIfAvailabilityUnknown?: false;
        }

        Configuration options, including common service parameters (e.g. key, customServiceBaseURL, onAPIRequest) forwarded to each availability request

        • OptionalexcludeIfAvailabilityUnknown?: false

          If true, places with unknown availability will be filtered out. Otherwise, they will be included.

          false
          

      Returns Promise<Places<P | EVChargingStationWithAvailabilityPlaceProps>>

      Promise resolving to places collection with merged availability

      Important: Availability requests are made sequentially to avoid exceeding API rate limits (QPS - Queries Per Second). For large result sets, this may take some time.

      Needs the same API key access as evChargingStationsAvailability. A place whose request fails, including for a key without that access, counts as having unknown availability.

      // Search for charging stations and add availability
      const results = await discoverPlaces({
      query: 'EV charging',
      at: [4.9, 52.3],
      radius: 5000
      });

      const withAvailability = await getPlacesWithEVAvailability(results, {
      excludeIfAvailabilityUnknown: true // Filter out stations with unknown availability
      });

      // Display only stations with known availability
      withAvailability.features.forEach(place => {
      const available = place.properties.chargingPark?.availability?.chargingPointAvailability.count;
      console.log(`${place.properties.poi?.name}: ${available} chargers`);
      });