Skip to content

Extend deck.gl tile fetching to enable multi-tile fetches #273

@kylebarron

Description

@kylebarron

Problem statement: currently, deck.gl has just one available callback for fetching tiles: TileLayer.getTileData. This is user-provided and is always called with just one tile at a time. This means that all fetches are necessarily independent.

For most historical uses of the deck.gl TileLayer this is not a problem. For sources like MVT, the tile responses usually come from different URLs in a single domain, and there would be no possibility to coalesce requests.

However for newer data sources like PMTiles or COG, each individual tile data source comes from the same URL. This means that we're unnecessarily making many requests when we could potentially make many fewer by coalescing tile ranges. E.g. if we have 20 tiles in the current viewport, we currently are forced to always make 20 requests, whereas if it's a grid of 5 columns by 4 rows, then with request coalescing we could make no more than 4 requests (one per row, where each row's bytes are adjacent in memory)

Requirements:

  • Update Source in @cogeotiff/core to have a fetchRanges option, with a maxCoalesceBytes
  • Update Tiff in @cogeotiff/core to have a fetchTiles option, which will fetch multiple tiles at once, coalescing up to maxCoalesceBytes
  • Update deck.gl TileLayer with a new user-facing prop getTileDataBatched that takes in an array of tiles and fetches all of them. This should be optional, falling back to getTileData if it doesn't exist.
  • Update Tileset2D class to call getTileDataBatched if it exists. Ref https://github.com/visgl/deck.gl/blob/32c5d8d91dea69bc14839283c5bbc2600603725b/modules/geo-layers/src/tileset-2d/tileset-2d.ts#L264
  • Update COGLayer to pass in getTileDataBatched, which calls the underlying cogeotiff's fetchTiles

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions