In this notebook I am trying to get access to the clicked station from a map layer. However, when I check the scatter_layer.getPickingInfo() I get the response

TypeError: Cannot read property 'info' of undefined

Do I need to dispatch an event or something like this in order to have Observable be aware of this from I’m doing something similar from examples from @mbostock using Clustergrammer-GL (e.g. clicking the row or column dendrograms sets a list of stations that is used to highlight a subset of map stations).

The function requires a parameter, and judging from the docs it doesn’t look like you’re supposed to call it directly:

Called when a layer is being hovered or clicked, before any user callbacks are called. The layer can override or add additional fields to the info object that will be passed to the callbacks.

My guess is that you can access the picking info on the info argument in interaction events.

Be sure to take a look at the picking guide.

1 Like

Thanks @mootari, I was using it incorrectly. I can pass the callback function when the layer is initialized. I’m using this layer to update the mutable variable inst_neighborhood.

  const scatterLayer = new deck.ScatterplotLayer({
      getPosition: d => d.position,
      getFillColor: d => d.color,
      // getRadius: d => d.radius,
      getRadius: radius,  
      opacity: 0.5, 
      pickable: true,
      autoHighlight: true,
      stroked: true,
      lineWidthMinPixels: 0.5,
      onHover: function(info, event){
        if ('object' in info){
          mutable inst_neighborhood = info.object.Neighborhood