2

How to display two layers simultaneously by clicking a button in openlayers3.

I want to display two layers simultaneously by clicking respective button, output should be displayed in a same map.

3

Add a onclick handler to the button, and then in the handler call the addLayer method twice, one time for each layer.

Pseudocode:

var layer1 = new ...
var layer2 = new ...

var map = new ...

$(button).on('click', function() {
  map.addLayer(layer1);
  map.addLayer(layer2);
}
);

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.