1

Currently when the map is dragged a few hundred API requests are sent due to many layers.

I would like the requests to only be sent when the map comes to a stop.

How can I achieve this?

closed as unclear what you're asking by Taras, xunilk, nmtoken, Jochen Schwarze, Fran Raga Nov 4 at 9:02

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    Can you tell a bit more about those requests? – TomazicM Nov 1 at 20:37
  • @TomazicM Sure, The requests are just the standard WMS requests which are sent to request the sounding tiles of the bounding box / tile location. Currently they are sent automatically when the map is moved. I would like them to only be sent when the user has stopped moving the map. Does that help? – Jack Nov 2 at 12:04
1

Solution is hiding amongst the options for generic L.gridLayer, which then also apply to L.tileLayer.wms layer, since it is extension of generic grid layer.

Option is updateWhenIdle. Description of the option in docs says:

Load new tiles only when panning ends. true by default on mobile browsers, in order to avoid too many requests and keep smooth navigation. false otherwise in order to display new tiles during panning, since it is easy to pan outside the keepBuffer option in desktop browsers.

So all you have to do is add this option to WMS layer creation:

updateWhenIdle: true
  • perfect thank you! – Jack Nov 2 at 23:09

Not the answer you're looking for? Browse other questions tagged or ask your own question.