Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to change the layer's attributes dynamically #517

Open
juzi5230 opened this issue Dec 9, 2021 · 1 comment
Open

how to change the layer's attributes dynamically #517

juzi5230 opened this issue Dec 9, 2021 · 1 comment

Comments

@juzi5230
Copy link

juzi5230 commented Dec 9, 2021

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,
})
@twojtasz
Copy link
Contributor

twojtasz commented Jan 2, 2022

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants