1

If I have a lot of active layers and eg. zooom in and out, dozens of tile xmlhttprequests are sent. This causes a problem in most browsers, clogging it so to speak, and leaving the map blank and dozens of Pending resource requests in Network Console (in eg. Chrome).

Any known work-around for this issue? I'm creating a map with dozens of layers for a client, and with some activity on the map (zoom, adding lots of layers simultaneously, etc), this issue will appear.

What is needed, I believe, is some internal queue in Leaflet.js, as the queue in eg. Chrome browser is buggy.

  • This is due to the browsers not being able to handle more than n requests simultaneously (I believe it's six per remote server, and 16 in total). That's why you see map-servers hosting tiles from a.mapbox.com, b.mapbox.com etc. – knutole Apr 8 '14 at 16:07
1

The solution is in the problem: do you need to switch each layer individually? Instead you could merge some layers to avoid to query n tiles * n layers. This article may help you to change your viewpoint.

If you don't change your viewpoint,

You can use WMS with an intermediate tile cache to keep decent performances. Why I recommend WMS although most people will say WMS is dead!? It's simply because you can query in one WMS call more than one layer and always return one image instead of a tile for each layer of information. You will hence only query n tiles * one image layer embedding multiple informations. You can look at this WMS Leaflet plugin after you made your WMS server.

You can also make tiles compositing if you are stuck with tiles layers you don't control using TileStache "Pixel sandwich" (as long as you are allowed to as it's could be considered as tiles request usage cheat: it's a cache mecanism)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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