1

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"
      })
2
  • Unrelated to your question: do you use a string for the opacity in the layer options. Use a number: opacity: 0.4.
    – erilem
    Commented Jan 16, 2015 at 17:20
  • yes looking at it I do, interestingly it works but I have fixed it. I Struggle with js a bit
    – Sethinacan
    Commented Jan 16, 2015 at 19:12

1 Answer 1

7

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.

1
  • Please mark the answer as correct.
    – erilem
    Commented Jan 17, 2015 at 7:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.