O'Reilly logo

OpenLayers 3 : Beginner's Guide by Erik Hazzard, Paul Spencer, Thomas Gratier

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – handling selection events

The next step is to display some information about photos when they are selected. To do this, we'll need to listen for an event on the select interaction's collection of selected features and retrieve the features that were selected. Our plan is to have some photo information display when we select features:

  1. Let's go ahead and get the framework for this set up first, by simply creating a <div> tag that will appear below the map. In your HTML code, add the following line after the map's <div> tag:
    <div id='photo_info ></div>
  2. The select interaction doesn't provide events directly related to features being selected or deselected, but it does maintain a collection of selected events and the collection object ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required