gi-nx / getMapboxLayerIdsForLayer
ts
function getMapboxLayerIdsForLayer(nameOrId: string): string[];Resolve a layer name or full layer id to the list of mapbox style layer ids currently rendered for it on the map.
A single Giraffe layer can produce multiple mapbox layers (fill + outline + symbol etc.), so this returns an array. Returns [] if the layer can't be resolved or none of its sub-layers are currently in the style.
Accepts:
- a
FullLayerIdfrom the layer tree (e.g."GIRPLA-12345.0","GIRTMP-foo") - a temp layer's bare name (
"foo"→ resolves to"GIRTMP-foo") - the human-readable name shown in the layer tree
- an uploaded
ProjectLayername (layer_full.name)
Parameters
| Parameter | Type |
|---|---|
nameOrId | string |
Returns
string[]
Example
typescript
const ids = await rpc.invoke("getMapboxLayerIdsForLayer", ["Buildings"]);
await rpc.invoke("addMapboxEventListener", ["click", 20, ids]);