vasturiano / globe.gl

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

Loading more data on Globe #128

Open Ivann-2612 opened 1 year ago

Ivann-2612 commented 1 year ago

Hello, how can I map the data and display, for example, more data at once on the globe, more points at once. I found an example where it displays one data after loading, but I want to display more from my API.

vasturiano commented 1 year ago

@Ivann-2612 you just need to extend the data objects that you pass onto the component. For example, you can set .pointsData initially with 10 points, and later extend the same array to have 20 points, including the initial 10 if you'd like to preserve those.

Ivann-2612 commented 1 year ago

Thank you very much. I have one more question, how can I make two buttons with + and - to be zoom-in and zoom-out like on the google map that has

Ivann-2612 commented 1 year ago

It also sometimes happens that the data on the globe is not initially displayed, have I perhaps set something wrong?

vasturiano commented 1 year ago

@Ivann-2612 there's no built-in functionality for zooming buttons, but all you have to do is to overlay your buttons, and then tie them to .pointOfView calls that change the camera altitude.

As for the data not being displayed, hard to say without more context. Could you make an online example that reproduces the issue?

Ivann-2612 commented 1 year ago

I use the data from the data.js file as shown in the attached image. After that, I import the data into the file where the globe is (import { data as dataPoint } from "./data/data.js";) and set labelsData={dataPoint} in the globe component. It doesn't teach me the data immediately, but only when I delete the data from data.js and record again. vast

Ivann-2612 commented 1 year ago

Do you have an example somewhere for ReactJS, how I can use the data from the API and use it via a hook.

vasturiano commented 1 year ago

@Ivann-2612 for React there is react-globe.gl.

Ivann-2612 commented 1 year ago

thank you