Atlaslog / Field Notes / deck.gl visualization
Field note · deck.gl visualization
Clicks always return info.object null
Quick answer
The click handler fires but receives color null, index -1 and object null, because the layer was never marked pickable or a full-screen layer above it wins the pick. Picking is a separate render pass that only opted-in layers join.
Symptom
- onClick receives { color: null, index: -1, picked: false, x: 412, y: 337, object: null, layer: null }.
- deck.pickObject({ x: 412, y: 337, radius: 4 }) also returns nothing for a clearly visible point.
- Hovering shows no feedback even with autoHighlight enabled.
Checklist
- Call deck.pickObject at the click coordinates to separate a layer problem from an event-wiring problem.
- Print pickable, visible and coordinateSystem for every layer via deck.layerManager.getLayers().
- Look for a background PolygonLayer covering the viewport that is still pickable.
- Check pickingRadius and whether the deck canvas sits beneath the MapLibre canvas.
Fix
Set pickable: true on the data layer, pickable: false on decorative full-screen layers, keep pickingRadius at 5, and pass complete business objects in data so info.object is populated.
Code
{ color: null, index: -1, picked: false, x: 412, y: 337, object: null, layer: null }var info = deck.pickObject({ x: 412, y: 337, radius: 4 });
console.log(info && info.layer ? info.layer.id : 'no layer', info && info.object);
Watch out
- Raising pickingRadius to 20 to make clicks easier picks neighbouring features and returns the wrong object.
- Storing only coordinate arrays in data means a successful pick still yields an object with no business fields.
English edition written for Atlaslog from the original Chinese field note. Code is unchanged and runs as-is.
Atlaslog (2026). Clicks always return info.object null. https://www.jingweizhi.com/en/cookbook/deckgl-pick-fail.html (accessed 2026-11-03).