With this example, you will also be able to learn some useful things that you will learn more deeply in Chapter 6, Styling Vector Layers. Perform the following steps to do just that:
From the support files available with this book (https://www.packtpub.com/web-development/openlayers-3-beginner's-guide), download the file
2360_08_01_simple_select.html
and put it in thesandbox
directory.Create a data directory in the
assets
folder, and put the filenutsv9_lea.geojson
there, or download it also from the support site.Put the file into a webserver directory, or use the Python-included server with
python -m SimpleHTTPServer
because of Ajax's same-origin policy requirements.Next, open your browser and navigate to the page hosted by your web server (for example,
http://localhost:8000/2360_08_01_simple_select.html
if you use the Python server) to click on the blue features. Use the Shift key, and select more than one feature to get...