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 – more options with ol.interaction.Select

Now, let's reuse the previous example and discover more.

  1. Start by copying 2360_08_01_simple_select.html in a new file called 2360_08_02_select_options.html.
  2. After the vectorEuropa declaration, add the following JavaScript code to create the vector layer for points. A new dataset, a GeoJSON file france_4326.geojson, is available on the book's webpage:
    var defaultFrancePoints = new ol.style.Style({ image: new ol.style.Circle({ fill: new ol.style.Fill({ color: 'blue' }), stroke: new ol.style.Stroke({ color: '#ffcc00' }), radius: 8 }) }); var selectFrancePoints = new ol.style.Style({ image: new ol.style.Circle({ fill: new ol.style.Fill({ color: '#ff0000' }), stroke: new ol.style.Stroke({ color: ...

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