vasturiano / globe.gl

UI component for Globe Data Visualization using ThreeJS/WebGL
https://vasturiano.github.io/globe.gl/example/world-population/
MIT License
1.97k stars 293 forks source link

Recommend way to have multiple visualizations on the same globe. #127

Open alew3 opened 1 year ago

alew3 commented 1 year ago

I want to create a globe with 3 different visualisations that are selected by the user to be viewed one at a time.

But I want for this to be a smooth transition. I tried instantiating a new globe for each visualisation, but the screen re-renders).

What I need is to remove the existing data from the globe but still maintain the globe skin (globeImageUrl , bumpImageUrl, backgroundImageUrl) and add the new data. I couldn't find a method that does this.

Is the way to this to set the data manually to null?

alew3 commented 1 year ago

This achieved what I wanted, but I'm not sure if it is the best way:

myGlobe .arcsData([]) .hexBinPointsData([]) .polygonsData([]) .hexPolygonsData([]) .tilesData([]) .ringsData([]) .labelsData([]) .htmlElementsData([]) .objectsData([]) .customLayerData([]) .pointsData([]);

alew3 commented 1 year ago

my solution above doesn't seem to clear labelsData ...

vasturiano commented 1 year ago

@alew3 thanks for reaching out.

Emptying out the data arrays is the appropriate solution for this. labelsData([]) should also be functioning properly. If it's not in your case, would you mind posting an online example that shows the issue?

alew3 commented 1 year ago

I was calling .labelsData([]) twice, I left just one and it fixed it.