aurora-opensource / streetscape.gl

Visualization framework for autonomy and robotics data encoded in XVIZ

Home Page:http://www.streetscape.gl

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

how to change the layer's attributes dynamically

juzi5230 opened this issue · comments

commented

I want to modify the color of GeoJsonLayer dynamically, but failed

new GeoJsonLayer({
  id: 'HEAT_MAP' ,
  data:  geojson, // geojson is a variable, everytime before render it will be computed again
  opacity: 1,
  stroked: false,
  extruded: true,
  elevationScale: 1,
  lineWidthUnits: 'meters',
  lineWidthMinPixels:1,
  lineWidthMaxPixels:3,
  getElevation: f => Math.sqrt(f.properties.valuePerSqm) * 10,
  getFillColor: d => {
    if(d.properties.num) return [255, 0, 0] // get the attribute of num and get the colorValue
    else return [0, 0, 0, 0]
  },
  getLineWidth: 1,
  getRadius: 10,
  getLineColor: [103, 113, 121],
  pickable: true,
})

I don't understand, you are passing geojson as a variable through XVIZ?

You could also pass this data out-of-band of XVIZ, and just use the GeoJsonLayer passed as a customLayer to the LogViewer?

However, if you are constructing the GeoJsonLayer, can't you just change the getLineColor array?