ismyrnow / Leaflet.functionaltilelayer

Leaflet tile layer with functionally defined URL and support for promises.
MIT License
72 stars 15 forks source link

Multiple Functional Layers #6

Closed gwacker closed 10 years ago

gwacker commented 10 years ago

Adding a second functional tile layers seems to conflict with the first.

I dynamically add a second functional tile layer, but after I remove it, the first functional tile layer return tile URLs with paths to tiles from the second layer I just removed.

ismyrnow commented 10 years ago

I'm not seeing this behavior. I tried it out by extending the basic example with the following code:

funcLayer2 = new L.TileLayer.Functional(function (view) {
  return 'http://otile1.mqcdn.com/tiles/1.0.0/sat/{z}/{y}/{x}.jpg'
    .replace('{z}', view.zoom)
    .replace('{x}', view.tile.row)
    .replace('{y}', view.tile.column);
  });
funcLayer2.addTo(map);
map.removeLayer(funcLayer2);

The result is as expected; the first layer continues to return 'map' theme tiles, instead of 'sat' tiles.

I'm going to close this for now, but feel free to provide an example (jsbin/jsfiddle) if you feel the issue is still there.