This is the documentation of version 0.64.0. Go to the latest version, 1.0.0-rc.5.
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), over the StylingFoundationsModule, BaseMapModule and POIsModule of the map. See mapPresetCatalogue for what each one sets.

      Parameters

      • map: TomTomMap

        The map to apply the preset to; the modules are created where they do not exist yet.

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

        merge: true lays the preset over the current settings. By default, the knobs the other presets set are reset first, 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