Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get a Map Control or Interaction

Tags:

openlayers-3

How does one get a specific ol.control or ol.interaction from ol.Map? I have several dynamically added maps on a single page and I want to be able to access the ol.interaction.Select.

like image 452
MoreScratch Avatar asked Aug 12 '15 16:08

MoreScratch


1 Answers

map.getInteractions().forEach(function (interaction) {
  if(interaction instanceof ol.interaction.Select) { ... }
});

Same thing for controls.

like image 191
Timh Avatar answered Sep 22 '22 20:09

Timh