Implement tileRequestsDelay for tile sources in mapbox-gl-js
Nobody has claimed this yet.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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