mapbox / mapbox/mapbox-gl-js

Implement tileRequestsDelay for tile sources in mapbox-gl-js

Open
#13,208 0 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature :green_apple:
Dominant language
TypeScript
Stars
12.4k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

## Motivation

On the android and ios SDKs, there is a `tileRequestsDelay` parameter that can be enforced. This avoids loading too many unuseful tiles during animations - especially flyTo - eg used within geocoder controls. This helps reducing load on client network,
cache, server request count etc. This parameter is not available on mapbox-gl-js

Solliciting a `flyTo` from a `zoom:16` location to another place at the same zoom level on the other side of the earth can provoke 1.000 map tiles requests. This led us to exceed the free quota of raster tiles API in only a few days - also because mapbox customers cannot enforce hard/soft spending limits/caps, which is another problem.

## Design Alternatives

`flyTo` duration can be set to zero to load only tiles at the arrival location. This would however remove the ability to use such animations while maintaining a decent amount of tile requests.

### Mock-Up

Could replicate the [-requests-delay](https://docs.mapbox.com/android/maps/api/11.4.1/mapbox-maps-android/com.mapbox.maps.extension.style.sources.generated/-raster-source/tile-requests-delay.html?query=fun%20tileRequestsDelay(value:%20Double%20=%200.0):%20RasterSource)

Related feature request, inactive for the past 6 years: https://github.com/mapbox/mapbox-gl-js/issues/5482

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files or tests are named. Start by comparing the Android and iOS tileRequestsDelay behavior described in the issue, then inspect the existing flyTo and tile-source loading paths in mapbox-gl-js, including related issue #5482. Done means the delay behavior is defined for tile sources during animations and verified against the excessive requests described here.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend, performance
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.