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
Hierarchy (View Summary)
- Evented
- TileManager
Index
Constructors
Properties
Methods
Constructors
constructor
-
new TileManager(
id: string,
options: CanvasSourceSpecification | SourceSpecification,
dispatcher: Dispatcher,
): TileManagerParameters
- id: string
- options: CanvasSourceSpecification | SourceSpecification
- dispatcher: Dispatcher
Returns TileManager
Properties
dispatcher
id
map
style
terrain
tileSize
transform
used
usedForTerrain
StaticmaxOverzooming
StaticmaxUnderzooming
Methods
areTilesLoaded
-
Returns boolean
clearTiles
-
Remove all tiles from this pyramid
Returns void
fire
-
Parameters
- event: string | Event
Optionalproperties: any
Returns this
getFeatureState
-
Get the entire state object for a feature
Parameters
- sourceLayer: string
- featureId: string | number
Returns FeatureState
getIds
-
Return all tile ids ordered with z-order, and cast to numbers
Returns string[]
getLoadedTile
-
Get a currently loaded tile.
- a cached tile is not a loaded tile
Parameters
- tileID: OverscaledTileID
Returns Tile | null
the tile if it's in view and had data, null otherwise.
getRenderableIds
-
Parameters
OptionalsymbolLayer: boolean
Returns string[]
getSource
-
Returns Source
getState
-
Returns SourceFeatureState
getTile
getTileByID
getVisibleCoordinates
-
Parameters
OptionalsymbolLayer: boolean
Returns OverscaledTileID[]
handleWrapJump
-
Parameters
- lng: number
Returns void
hasRenderableParent
-
Parameters
- tileID: OverscaledTileID
Returns boolean
hasTransition
-
Returns boolean
listens
-
Returns a true if this instance of Evented or any forwardeed instances of Evented have a listener for the specified type.
Parameters
- type: string
The event type
Returns boolean
trueif there is at least one registered listener for specified event type,falseotherwise - type: string
loaded
-
Return true if no tile data is pending, tiles will not change unless an additional API call is received.
Returns boolean
off
-
Removes a previously registered event listener.
Parameters
- type: string
The event type to remove listeners for.
- listener: Listener
The listener function to remove.
Returns this
- type: string
on
-
Adds a listener to a specified event type.
Parameters
- type: string
The event type to add a listen for.
- listener: Listener
The function to be called when the event is fired. The listener function is called with the data object passed to
fire, extended withtargetandtypeproperties.
Returns Subscription
- type: string
onAdd
-
Parameters
- map: MapLibreMap
Returns void
once
-
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.
Parameters
- type: string
The event type to listen for.
Optionallistener: ListenerThe function to be called when the event is fired the first time.
Returns TileManager | Promise<any>
thisor a promise if a listener is not provided - type: string
onRemove
-
Parameters
- map: MapLibreMap
Returns void
pause
-
Returns void
prepare
-
Parameters
- context: Context
Returns void
refreshTiles
-
Reload any currently renderable tiles that are match one of the incoming
tileIdx/y/zParameters
- tileIds: ICanonicalTileID[]
Returns void
releaseSymbolFadeTiles
-
Returns void
reload
-
Reload tiles based on the current state of the source.
Parameters
OptionalsourceDataChanged: booleanIf
true, reload all tiles using a state of 'expired', otherwise reload only non-errored tiles using state of 'reloading'.OptionalshouldReloadTileOptions: anySet of options associated with a
MapSourceDataChangedEventthat can be passed back to the associatedSourcedetermine whether a tile should be reloaded.
Returns void
reloadTilesForDependencies
-
Reloads all tiles that depend on the given keys.
Parameters
- namespaces: string[]
- keys: string[]
Returns void
removeFeatureState
-
Resets the value of a particular state key for a feature
Parameters
OptionalsourceLayer: stringOptionalfeatureId: string | numberOptionalkey: string
Returns void
resume
-
Returns void
serialize
-
Returns any
setDependencies
-
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
setEventedParent
-
Bubble all events fired by this instance of Evented to this parent instance of Evented.
Parameters
Optionalparent: Evented | nullOptionaldata: any
Returns this
setFeatureState
-
Set the value of a particular state for a feature
Parameters
- sourceLayer: string
- featureId: string | number
- state: any
Returns void
setRasterFadeDuration
-
Parameters
- fadeDuration: number
Returns void
tilesIn
-
tilesIn(
pointQueryGeometry: Point[],
maxPitchScaleFactor: number,
has3DLayer: boolean,
): TileResult[]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. - pointQueryGeometry: Point[]
update
-
Removes tiles that are outside the viewport and adds new tiles that are inside the viewport.
Parameters
- transform: ITransform
Optionalterrain: Terrain
Returns void
updateCacheSize
-
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
- transform: IReadonlyTransform
Returns void
Methods mixed in to other classes for event capabilities.