How to add some text for a layer deckgl?

Viewed 906

I am new with deckgl. I want to add some text to my layer (any type of layer) but I'm not able to

Here is my example:

const layer = new PointCloudLayer({
  id: 'point-c-layer',
  data: [{
    position: [39.826168, 21.422510],
    normal: [-1, 0, 0],
    color: [204, 102, 0],
  }],
  radiusPixels: 20,    
});

What I should add in data array to add my text to this layer?

1 Answers

Add the text to a separate TextLayer like this:

const text = new TextLayer({
  id: 'text-layer',
  data: [
    {text: '#San Francisco', coordinates: [-122.425586, 37.775049]}
  ]
})

return (<DeckGL {...viewport} layers={[pointcloud, text]} />)
Related