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
Implements
Index
Constructors
Properties
allowVerticalPlacement
bucketInstanceId
canOverlap
collisionArrays
collisionBoxArray
collisionCircleArray
compareText
fadeStartTime
features
featureSortOrder
glyphOffsetArray
hasDependencies
hasRTLText
icon
iconCollisionBox
iconsInText
iconSizeData
iconsNeedLinear
index
justReloaded
layerIds
layers
lineVertexArray
maxGlyphs
maxHeightOffset
overscaling
pixelRatio
sdfIcons
sortedAngle
sortFeaturesByKey
sortFeaturesByY
sortKeyRanges
sourceID
sourceLayerIndex
stateDependentLayerIds
stateDependentLayers
symbolInstanceIndexes
symbolInstances
text
textAnchorOffsets
textCollisionBox
textSizeData
tilePixelRatio
uploaded
writingModes
zoom
Methods
addCollisionDebugVertices
addDebugCollisionBoxes
addFeatures
addIndicesForPlacedSymbol
addSymbols
addToLineVertexArray
addToSortKeyRanges
createArrays
deserializeCollisionBoxes
destroy
destroyDebugData
generateCollisionDebugBuffers
getSortedSymbolIndexes
hasDebugData
hasIconCollisionBoxData
hasIconData
hasTextCollisionBoxData
hasTextData
isEmpty
populate
sortFeatures
update
upload
uploadPending
Constructors
constructor
Parameters
- options: BucketParameters<SymbolStyleLayer>
Returns SymbolBucket
Properties
allowVerticalPlacement
allowVerticalPlacement: boolean
bucketInstanceId
bucketInstanceId: number
canOverlap
canOverlap: boolean
collisionArrays
collisionBoxArray
collisionCircleArray
collisionCircleArray: number[]
compareText
fadeStartTime
fadeStartTime: number
features
featureSortOrder
featureSortOrder: number[]
glyphOffsetArray
hasDependencies
hasDependencies: boolean
hasRTLText
hasRTLText: boolean
icon
iconCollisionBox
iconsInText
iconsInText: boolean
iconSizeData
iconsNeedLinear
iconsNeedLinear: boolean
index
index: number
justReloaded
justReloaded: boolean
layerIds
layerIds: string[]
layers
lineVertexArray
maxGlyphs
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
maxHeightOffset: number
overscaling
overscaling: number
pixelRatio
pixelRatio: number
sdfIcons
sdfIcons: boolean
sortedAngle
sortedAngle: number
sortFeaturesByKey
sortFeaturesByKey: boolean
sortFeaturesByY
sortFeaturesByY: boolean
sortKeyRanges
sourceID
sourceID: string
sourceLayerIndex
sourceLayerIndex: number
stateDependentLayerIds
stateDependentLayerIds: string[]
stateDependentLayers
symbolInstanceIndexes
symbolInstanceIndexes: number[]
symbolInstances
text
textAnchorOffsets
textCollisionBox
textSizeData
tilePixelRatio
tilePixelRatio: number
uploaded
uploaded: boolean
writingModes
zoom
zoom: number
Methods
addCollisionDebugVertices
- addCollisionDebugVertices(
x1: number,
y1: number,
x2: number,
y2: number,
arrays: CollisionBuffers,
boxAnchorPoint: Point,
symbolInstance: SymbolInstanceStruct,
): voidParameters
- x1: number
- y1: number
- x2: number
- y2: number
- arrays: CollisionBuffers
- boxAnchorPoint: Point
- symbolInstance: SymbolInstanceStruct
Returns void
addDebugCollisionBoxes
- addDebugCollisionBoxes(
startIndex: number,
endIndex: number,
symbolInstance: SymbolInstanceStruct,
isText: boolean,
): voidParameters
- startIndex: number
- endIndex: number
- symbolInstance: SymbolInstanceStruct
- isText: boolean
Returns void
addFeatures
Parameters
- __namedParameters: BucketDependencyParameters
Returns void
addIndicesForPlacedSymbol
Parameters
- iconOrText: SymbolBuffers
- placedSymbolIndex: number
Returns void
addSymbols
- addSymbols(
arrays: SymbolBuffers,
quads: SymbolQuad[],
sizeVertex: any,
lineOffset: [number, number],
alongLine: boolean,
feature: SymbolFeature,
writingMode: WritingMode,
labelAnchor: Anchor,
lineStartIndex: number,
lineLength: number,
associatedIconIndex: number,
canonical: CanonicalTileID,
elevation: number,
): voidParameters
- arrays: SymbolBuffers
- quads: SymbolQuad[]
- sizeVertex: any
- lineOffset: [number, number]
- alongLine: boolean
- feature: SymbolFeature
- writingMode: WritingMode
- labelAnchor: Anchor
- lineStartIndex: number
- lineLength: number
- associatedIconIndex: number
- canonical: CanonicalTileID
- elevation: number
Returns void
addToLineVertexArray
addToSortKeyRanges
Parameters
- symbolInstanceIndex: number
- sortKey: number
Returns void
createArrays
Returns void
deserializeCollisionBoxes
Parameters
- collisionBoxArray: CollisionBoxArray
Returns void
destroy
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
destroyDebugData
Returns void
generateCollisionDebugBuffers
Returns void
getSortedSymbolIndexes
Parameters
- angle: number
Returns number[]
hasDebugData
Returns CollisionBuffers
hasIconCollisionBoxData
Returns boolean
hasIconData
Returns boolean
hasTextCollisionBoxData
Returns boolean
hasTextData
Returns boolean
isEmpty
Returns boolean
populate
- populate(
features: IndexedFeature[],
options: PopulateParameters,
canonical: CanonicalTileID,
): voidParameters
- features: IndexedFeature[]
- options: PopulateParameters
- canonical: CanonicalTileID
Returns void
sortFeatures
Parameters
- angle: number
Returns void
update
- update(
states: FeatureStates,
vtLayer: VectorTileLayerLike,
imagePositions: { [_: string]: ImagePosition },
): voidParameters
- states: FeatureStates
- vtLayer: VectorTileLayerLike
- imagePositions: { [_: string]: ImagePosition }
Returns void
upload
Parameters
- context: Context
Returns void
uploadPending
Returns boolean
Internal
Unlike other buckets, which simply implement
addFeaturewith type-specific logic for (essentially) triangulating feature geometries, SymbolBucket requires specialized behavior: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).
WorkerTile asynchronously requests from the main thread all of the glyphs and icons needed (by this bucket and any others).
WorkerTile calls SymbolBucket.addFeatures(), which delegates text shaping and layout to performSymbolLayout(). This step populates:
this.symbolInstances: metadata on generated symbolsthis.collisionBoxArray: collision data for use by foregroundthis.text: SymbolBuffers for text symbolsthis.icons: SymbolBuffers for iconsthis.iconCollisionBox: Debug SymbolBuffers for icon collision boxesthis.textCollisionBox: Debug SymbolBuffers for text collision boxes The results are sent to the foreground for renderingplacement.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".