微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

对于特定的 geojson 功能,deck.gl 使用 glb 文件ScenegraphLayer

如何解决对于特定的 geojson 功能,deck.gl 使用 glb 文件ScenegraphLayer

如何基于geoJson特征添加ScenegraphLayer图层或图标

{
  features: [
    {
     "geometry":{
            "coordinates":[],"type":"Multipolygon"
         },"properties":{
            "icon":"building"
         },"type":"Feature"
      },{
         "geometry":{
            "coordinates":[
               18.98610373826882,53.0069576418497
            ],"type":"Point"
         },"properties":{
            "icon":"car"
         },"type":"Feature"
      } 
 ]
}

  const overlay = new DeckOverlay({
    layers: [
       //this will work when we are adding statically,it will create car image at 19.01,52.72 cords
      new ScenegraphLayer({
        id: 'scene',scenegraph: "./car_icon.glb",data: [{coordinates: [19.01,52.72]}],getPosition: (d) => d.coordinates,}),new GeoJsonLayer({
        id: 'geojson',data: "./geoJsonData.json",getFillColor: (f) => {
          
           // here how we change fill color based on type,is it possible to create ScenegraphLayer based 
          //  on feature type?

          if (f.properties.icon === 'car') return [0,153,220];
          if (f.properties.icon === 'building') return [220,220];
        }
      })
    ]
  });

  overlay.setMap(map);

上面的 json 有 2 个功能汽车和建筑物。当每个特征中的properties.icon 是“car”和“building”时,如何添加car.glb 和buiding.glb 图标?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。