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 SymbolBucket

Unlike other buckets, which simply implement addFeature with type-specific logic for (essentially) triangulating feature geometries, SymbolBucket requires specialized behavior:

  1. WorkerTile.parse(), the logical owner of the bucket creation process, calls SymbolBucket.populate(), which resolves text and icon tokens on each feature, adds each glyphs and symbols needed to the passed-in collections options.glyphDependencies and options.iconDependencies, and stores the feature data for use in subsequent step (this.features).

  2. WorkerTile asynchronously requests from the main thread all of the glyphs and icons needed (by this bucket and any others).

  3. WorkerTile calls SymbolBucket.addFeatures(), which delegates text shaping and layout to performSymbolLayout(). This step populates: this.symbolInstances: metadata on generated symbols this.collisionBoxArray: collision data for use by foreground this.text: SymbolBuffers for text symbols this.icons: SymbolBuffers for icons this.iconCollisionBox: Debug SymbolBuffers for icon collision boxes this.textCollisionBox: Debug SymbolBuffers for text collision boxes The results are sent to the foreground for rendering

  4. placement.ts is run on the foreground, and uses the CollisionIndex along with current camera settings to determine which symbols can actually show on the map. Collided symbols are hidden using a dynamic "OpacityVertexArray".

Implements

Index

Constructors

Properties

allowVerticalPlacement: boolean
bucketInstanceId: number
canOverlap: boolean
collisionArrays: CollisionArrays[]
collisionBoxArray: CollisionBoxArray
collisionCircleArray: number[]
compareText: { [_: string]: Point[] }
fadeStartTime: number
features: SymbolFeature[]
featureSortOrder: number[]
glyphOffsetArray: GlyphOffsetArray
hasDependencies: boolean
hasRTLText: boolean
iconCollisionBox: CollisionBuffers
iconsInText: boolean
iconSizeData: SizeData
iconsNeedLinear: boolean
index: number
justReloaded: boolean
layerIds: string[]
lineVertexArray: SymbolLineVertexArray
maxGlyphs: number

The glyph cap for this bucket, normally MAX_GLYPHS. Tests lower it to exercise the overflow warning without filling a bucket with 65,535 glyphs.

maxHeightOffset: number
overscaling: number
pixelRatio: number
sdfIcons: boolean
sortedAngle: number
sortFeaturesByKey: boolean
sortFeaturesByY: boolean
sortKeyRanges: SortKeyRange[]
sourceID: string
sourceLayerIndex: number
stateDependentLayerIds: string[]
stateDependentLayers: SymbolStyleLayer[]
symbolInstanceIndexes: number[]
symbolInstances: SymbolInstanceArray
textAnchorOffsets: TextAnchorOffsetArray
textCollisionBox: CollisionBuffers
textSizeData: SizeData
tilePixelRatio: number
uploaded: boolean
writingModes: WritingMode[]
zoom: number

Methods

  • Parameters

    Returns void

  • Parameters

    Returns void

  • Parameters

    Returns void

  • Parameters

    Returns { lineLength: number; lineStartIndex: number }

  • Parameters

    • symbolInstanceIndex: number
    • sortKey: number

    Returns void

  • Returns void

  • Release the WebGL resources associated with the buffers. Note that because buckets are shared between layers having the same layout properties, they must be destroyed in groups (all buckets for a tile, or all symbol buckets).

    Returns void

  • Returns void

  • Returns void

  • Parameters

    • angle: number

    Returns number[]

  • Returns boolean

  • Returns boolean

  • Returns boolean

  • Returns boolean

  • Returns boolean

  • Parameters

    • angle: number

    Returns void

Was this helpful?