react-globe.gl icon indicating copy to clipboard operation
react-globe.gl copied to clipboard

Performance issue when adding too many tiles to the map

Open furkancelik opened this issue 3 years ago • 2 comments

Hi, I added more tiles as in the picture. (I need more tiles) I want to increase this number of tiles but there is a performance issue. How can we solve this?

Ekran Resmi 2022-01-19 17 20 08

Code

const GRID_SIZE = [50, 50];

  const tileWidth = 360 / GRID_SIZE[0];
  const tileHeight = 180 / GRID_SIZE[1];
  const tilesData = [];
  [...Array(GRID_SIZE[0]).keys()].forEach((lngIdx) =>
    [...Array(GRID_SIZE[1]).keys()].forEach((latIdx) =>
      tilesData.push({
        lng: -180 + lngIdx * tileWidth,
        lat: -90 + (latIdx + 0.5) * tileHeight,
      })
    )
  );

How many tiles are created when I make grid size [50,50]?
(I need 1000000 tiles in total. )

furkancelik avatar Jan 19 '22 14:01 furkancelik

@furkancelik in that example a grid size of [50,50] would lead to 50x50 = 2500 tiles.

1M tiles seems well beyond what would be achievable with these tile objects (each is essentially a sliced segment of a ThreeJs sphere). I would say that going above 20k tiles at any given time starts struggling performance wise.

vasturiano avatar Jan 19 '22 22:01 vasturiano

@vasturiano following up on an old thread here. Is there optimization available to improve the performance despite 20K++ tiltes? For example, I found this project online, which seems to use a very similar (if not the same) package as react-globe, which loads with pretty much no lag, despite having hundreds of thousands of tiles.

luke-anykraft avatar Apr 03 '22 08:04 luke-anykraft