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 – extending ol.control.Control to make your own control

Let's get started. Contrary to most examples, it will need more code than usual. So, to keep things simple, we will explain how to build the sample by retrieving the various code files instead of inlining it. After these operations, we will focus on the important parts of the code to understand them:

  1. Go to the samples directory and retrieve all the css class with the export-geojson string from assets/css/samples.css and copy paste them in your own samples.css file. Next, retrieve a new JavaScript file from https://github.com/eligrey/FileSaver.js/blob/master/FileSaver.js into a new subdirectory, assets/js.
  2. If you don't already have it from Chapter 8, Interacting with Your Map ...

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