【问题标题】:How to add some text for a layer deckgl?如何为图层deckgl添加一些文本?
【发布时间】:2018-01-10 06:45:04
【问题描述】:

我是新来的deckgl。我想向我的图层(任何类型的图层)添加一些文本,但我不能

这是我的例子:

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

我应该在数据数组中添加什么来将我的文本添加到这一层?

【问题讨论】:

    标签: deck.gl


    【解决方案1】:

    将文本添加到单独的TextLayer,如下所示:

    const text = new TextLayer({
      id: 'text-layer',
      data: [
        {text: '#San Francisco', coordinates: [-122.425586, 37.775049]}
      ]
    })
    
    return (<DeckGL {...viewport} layers={[pointcloud, text]} />)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-04-09
      • 1970-01-01
      • 1970-01-01
      • 2013-09-09
      • 2021-12-11
      • 1970-01-01
      • 1970-01-01
      • 2020-06-25
      相关资源
      最近更新 更多