Class StackedMapsExperimental

Stacked Maps enables multi floor visualization. It allows for multiple floors of a building to be shown together as a stack of floors in an accordion style view.

This class is accessed using MapView.StackedMaps.

Refer to the Stacked Maps Guide for more information and interactive examples.

Hierarchy (View Summary, Expand)

Properties

expandedFactor: number = 0

The factor of the expanded floor stack. 0 is collapsed, 1 is fully expanded.

Accessors

  • get distanceBetweenFloors(): number
  • Experimental

    Gets the distance between floors in meters.

    This property returns different values based on how the expand() method was called:

    • When expand() was called with distanceBetweenFloors: 'auto', this returns the computed value needed to visually separate the first two floors in clip space.
    • When expand() was called with a numeric value (e.g., distanceBetweenFloors: 50), this returns that specified value.

    This value is cached for performance until clearCachedFloorSeparationDistance() is called to force a recalculation.

    Returns number

    // Using automatic floor separation distance
    await mapView.StackedMaps.expand({ distanceBetweenFloors: 'auto' });
    console.log(mapView.StackedMaps.distanceBetweenFloors); // Returns computed separation value

    // Using fixed floor separation distance
    await mapView.StackedMaps.expand({ distanceBetweenFloors: 50 });
    console.log(mapView.StackedMaps.distanceBetweenFloors); // Returns 50
  • get expanded(): boolean
  • Experimental

    Whether the floor stack is expanded.

    Returns boolean

  • get floorVisibilityMode(): "all-floors" | "only-current-floor"
  • Experimental

    The visibility mode for the stacked maps. 'all-floors' will show all floors, 'only-current-floor' will only show the current floor in the stack.

    Returns "all-floors" | "only-current-floor"

    'all-floors'
    
  • get includedFloors(): Floor[]
  • Experimental

    The floors included in the stack.

    Returns Floor[]

Methods

  • Experimental

    Set whether to listen to camera elevation changes to automatically change the floor. When enabled, the mapView.on('floor-change') event is fired

    Parameters

    • value: boolean

    Returns void

  • Experimental

    Clears the cached value for the computed distance between floors.

    Call this method to invalidate the calculation of the optimal distance between floors when using distanceBetweenFloors: 'auto' option with the expand() method. This is useful when the camera position or viewport has changed significantly, which may affect the optimal floor separation distance.

    Returns void

    // Force recalculation before expanding with auto distance
    mapView.StackedMaps.clearCachedFloorSeparationDistance();
    await mapView.StackedMaps.expand({ distanceBetweenFloors: 'auto' });
  • Experimental

    Expand the floor stack.

    Parameters

    Returns Promise<void>

  • Experimental

    Unsubscribe a function previously subscribed with on

    Type Parameters

    • EVENT_NAME extends "stacked-maps-state-change"

    Parameters

    • eventName: EVENT_NAME

      An event name to which the provided function was previously subscribed.

    • fn: (
          payload: TStackedMapsEvents[EVENT_NAME] extends { data: null }
              ? any[any]["data"]
              : TStackedMapsEvents[EVENT_NAME],
      ) => void

      A function that was previously passed to on. The function must have the same reference as the function that was subscribed.

    Returns void

    // Unsubscribe from the 'click' event
    const handler = (event) => {
    console.log('Map was clicked', event);
    };
    map.off('click', handler);
  • Experimental

    Subscribe a function to an event.

    Type Parameters

    • EVENT_NAME extends "stacked-maps-state-change"

    Parameters

    • eventName: EVENT_NAME

      An event name which, when fired, will call the provided function.

    • fn: (
          payload: TStackedMapsEvents[EVENT_NAME] extends { data: null }
              ? any[any]["data"]
              : TStackedMapsEvents[EVENT_NAME],
      ) => void

      A callback that gets called when the corresponding event is fired. The callback will get passed an argument with a type that's one of event payloads.

    Returns void

    // Subscribe to the 'click' event
    const handler = (event) => {
    const { coordinate } = event;
    const { latitude, longitude } = coordinate;
    console.log(`Map was clicked at ${latitude}, ${longitude}`);
    };
    map.on('click', handler);
  • Experimental

    Set the visibility mode for the stacked maps.

    Parameters

    • mode: "all-floors" | "only-current-floor"

      The visibility mode to set. Either all-floors or only-current-floor.

    Returns void

MMNEPVFCICPMFPCPTTAAATR