Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OverlayLayerDirective renders more than one layer at once #440

Open
bpatrik opened this issue Jul 20, 2019 · 0 comments
Open

OverlayLayerDirective renders more than one layer at once #440

bpatrik opened this issue Jul 20, 2019 · 0 comments

Comments

@bpatrik
Copy link

bpatrik commented Jul 20, 2019

Describe the bug
Using multiple <yaga-tile-layer\> in a <yaga-layers-control\>, the layer control will render all tile layer at once on top of eachother. (Only the top one will be visible.) That uses extra CPU and network traffic unnecessarily.
If you select a new layer, it works properly:
After selection, only the new layer will be rendered (and loaded over the netwrok).

To Reproduce
You can see the issue in the official layer-cotrol demo: https://leaflet-ng2.yagajs.org/latest/examples/layers-control-directive/
You can open the developer console and see that it loads both https://b.tile.opentopomap.org/3/3/4.png https://b.tile.openstreetmap.org/3/3/4.png tiles, but only the topomaps are vidible as the streetmaps are rendered below them.

Expected behavior
It should only load one of the tiles/layers and render that one.

Update:
Possible 'hack' / workaround:

I have 5 layers in my map in this order:

  1. markers
  2. paths
  3. street
  4. satelite
  5. hybrid

I wanted to show the markers with paths on the street layer by default. This made the trick:

 ngOnInit(): void {
    let i = 0;
    this.yagaMap.eachLayer(l => {
      if (i++ >= 3) {
        this.yagaMap.removeLayer(l);
      }
    });
  }
@bpatrik bpatrik changed the title OverlayLayerDirective renders more than layer at once OverlayLayerDirective renders more than one layer at once Jul 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant