[GIS] Openlayers 3 attribution – source/ credit

openlayers

I can't get attribution (source/ credit) to show up for WMS layers added to and OL3 map.
The attribution for base layers (OSM etc) works fine but when I try and use the attribution parameter to add attribution to my WMS layers no attribution shows up – any ideas?

        }),
        title:"Special Protection Areas",
        opacity:"0.4",
        attribution: "where it came from"
      })

Best Answer

The attributions should be set on the source. So, in the case of an TileWMS source, it will look like this:

var layer = new ol.layer.Tile({
  source: new ol.source.TileWMS({
    attributions: [new ol.Attribution({
      html: "Where it came from"
    })]
  })
})

See this example for example: http://openlayers.org/en/master/examples/wms-custom-proj.html.

Related Question