TomTom Maps for JavaScript
    Preparing search index...

    Function applyMapPreset

    • Applies a map preset, a named bundle of knob settings the SDK ships for a common intent (data-viz, night-driving, minimal, globe), to the map's StylingFoundationsModule, BaseMapModule and POIsModule. mapPresetCatalogue lists what each one sets.

      Parameters

      • map: TomTomMap

        The map to apply the preset to. The SDK creates the modules that don't exist yet.

      • id: "globe" | "data-viz" | "night-driving" | "minimal"
      • options: { merge?: boolean } = {}

        merge: true lays the preset over the current settings. By default, the SDK first resets the knobs the other presets set, so switching presets leaves nothing of the last one. Every other knob keeps its value either way.

      Returns Promise<void>

      Error for an unknown preset id.

      await applyMapPreset(map, 'data-viz');
      setKnob(styling, stylingFoundationsKnobCatalogue, 'labels.sizeFactor', 1.1); // then adjust

      await applyMapPreset(map, 'globe', { merge: true }); // keep the rest, switch to a globe with a sky