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 – changing the default attribution styles

Attributions, as a reminder, are the way to mention credits for layers sources that reference source of the tiles and/or data. The ol.control.Attribution control is dedicated for this.

  1. First, copy the example dedicated to the defaults controls in a new file.
  2. Next, change the ol.control.defaults options in the controls property of the map, and also set logo options to false at the ol.Map level:
    logo: false
    controls: ol.control.defaults({
      attributionOptions: {
      },
    }),
  3. Open your browser (we suppose you are using Google Chrome).
  4. Now, add in attributionOptions to the following content and reload the page:
    attributionOptions: {
      className: 'myCustomClass'
    },
  5. Use the Chrome Developers tools to find the ...

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