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

Load different layers with random colors #44

Open
agentili opened this issue Jun 20, 2017 · 1 comment
Open

Load different layers with random colors #44

agentili opened this issue Jun 20, 2017 · 1 comment

Comments

@agentili
Copy link

I have a visualization problem when an user try to load more than 1 layer falling in the same location.
As per actual configuration in my web page I'm not able to assign different colors respect to layers loaded.

Is there any way to change color of layer during the loading??

E.g.

  1. First layer loaded -> green
  2. Second Layer loaded -> red
  3. Third Layer loaded -> blue
  4. Fourth Layer loaded -> any random color

Thanks for your answers

@johnd0e
Copy link

johnd0e commented Mar 26, 2019

Is there any way to change color of layer during the loading??

Sure.

var style = { color: 'green' };
var control = L.Control.fileLayerLoad({ layerOptions: {style: style} }).addTo(map);
control.loader.on('data:loaded', function (e) {
  style.color = 'red'; // change to cycle/random colors
});

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

2 participants