mapbox / mapbox-gl-js

Interactive, thoroughly customizable maps in the browser, powered by vector tiles and WebGL
https://docs.mapbox.com/mapbox-gl-js/
Other
10.87k stars 2.19k forks source link

Implement tileRequestsDelay for tile sources in mapbox-gl-js #13208

Open jo-chemla opened 2 days ago

jo-chemla commented 2 days ago

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

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