For AI agents: a documentation index is available at /llms.txt. Markdown versions of all pages are available by appending .md to any URL.

Class TileManager

TileManager is responsible for

  • creating an instance of Source
  • caching tiles loaded from an instance of Source
  • handling incoming source data events events from Map and coordinating updates
  • providing the current renderable tile coordinates to the Painter
  • loading the tiles needed to render a given viewport
  • retaining the tiles needed as substitutes for pending loading tiles
  • retaining the tiles needed for fading between parents and children (for raster sources)
  • reloading tiles when source data or dependencies change
  • handling tile expiration and refresh timers
  • unloading cached tiles not needed to render a given viewport
  • managing tile state and feature state

Hierarchy (View Summary)

Index

Constructors

Properties

dispatcher: Dispatcher
id: string
map: MapMLGL
style: StyleMLGL
terrain: Terrain
tileSize: number
transform: ITransform
used: boolean
usedForTerrain: boolean
maxOverzooming: number
maxUnderzooming: number

Methods

  • Returns boolean

  • Remove all tiles from this pyramid

    Returns void

  • Get the entire state object for a feature

    Parameters

    • sourceLayer: string
    • featureId: string | number

    Returns FeatureState

  • Return all tile ids ordered with z-order, and cast to numbers

    Returns string[]

  • Get a currently loaded tile.

    • a cached tile is not a loaded tile

    Parameters

    Returns Tile | null

    the tile if it's in view and had data, null otherwise.

  • Parameters

    • OptionalsymbolLayer: boolean

    Returns string[]

  • Get a specific tile by id

    Parameters

    • id: string

    Returns Tile | undefined

  • Parameters

    • lng: number

    Returns void

  • Returns boolean

  • Returns a true if this instance of Evented or any forwardeed instances of Evented have a listener for the specified type.

    Parameters

    Returns boolean

    true if there is at least one registered listener for specified event type, false otherwise

  • Return true if no tile data is pending, tiles will not change unless an additional API call is received.

    Returns boolean

  • Removes a previously registered event listener.

    Type Parameters

    Parameters

    • type: T

      The event type to remove listeners for.

    • listener: (event: SourceEventType[T]) => void

      The listener function to remove.

    Returns this

  • Adds a listener to a specified event type.

    Type Parameters

    Parameters

    • type: T

      The event type to add a listen for.

    • listener: (event: SourceEventType[T]) => void

      The function to be called when the event is fired. The listener function is called with the data object passed to fire, extended with target and type properties.

    Returns Subscription

  • Adds a listener that will be called only once to a specified event type.

    The listener will be called first time the event fires after the listener is registered.

    Type Parameters

    Parameters

    • type: T

      The event type to listen for.

    Returns Promise<SourceEventType[T]>

    a promise that resolves with the event

  • Adds a listener that will be called only once to a specified event type.

    The listener will be called first time the event fires after the listener is registered.

    Type Parameters

    Parameters

    • type: T

      The event type to listen for.

    • listener: (event: SourceEventType[T]) => void

      The function to be called when the event is fired the first time.

    Returns this

    this when a listener is provided

  • Returns void

  • Reload any currently renderable tiles that are match one of the incoming tileId x/y/z

    Parameters

    Returns void

  • Returns void

  • Reload tiles based on the current state of the source.

    Parameters

    • OptionalsourceDataChanged: boolean

      If true, reload all tiles using a state of 'expired' (errored tiles use 'loading' since they have nothing to show yet), otherwise reload only non-errored tiles using state of 'reloading'.

    • OptionalshouldReloadTileOptions: any

      Set of options associated with a MapSourceDataChangedEvent that can be passed back to the associated Source determine whether a tile should be reloaded.

    Returns void

  • Reloads all tiles that depend on the given keys.

    Parameters

    • namespaces: string[]
    • keys: string[]

    Returns void

  • Resets the value of a particular state key for a feature

    Parameters

    • OptionalsourceLayer: string
    • OptionalfeatureId: string | number
    • Optionalkey: string

    Returns void

  • Forgets the recorded maximum content elevation, so the next update recomputes it from the current layers and loaded tiles. Called when a symbol layer is removed, since the removed layer's heights would otherwise keep expanding tile coverage.

    Returns void

  • Returns void

  • Returns any

  • Sets the set of keys that the tile depends on. This allows tiles to be reloaded when their dependencies change.

    Parameters

    • tileKey: string
    • namespace: string
    • dependencies: string[]

    Returns void

  • Set the value of a particular state for a feature

    Parameters

    • sourceLayer: string
    • featureId: string | number
    • state: any

    Returns void

  • Parameters

    • fadeDuration: number

    Returns void

  • Search through our current tiles and attempt to find the tiles that cover the given bounds.

    Parameters

    • pointQueryGeometry: Point[]

      coordinates of the corners of bounding rectangle

    • maxPitchScaleFactor: number
    • has3DLayer: boolean

    Returns TileResult[]

    result items have {tile, minX, maxX, minY, maxY}, where min/max bounding values are the given bounds transformed in into the coordinate space of this tile.

  • Removes tiles that are outside the viewport and adds new tiles that are inside the viewport.

    Parameters

    Returns void

  • Resizes the tile cache based on the current viewport's size or the maxTileCacheSize option passed during map creation

    Larger viewports use more tiles and need larger caches. Larger viewports are more likely to be found on devices with more memory and on pages where the map is more important.

    Parameters

    Returns void

Was this helpful?