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

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.

  • Please mark the answer as correct. – erilem Jan 17 '15 at 7:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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