1

I try to export my map to picture with the same method like this example of OpenLayers 3.

The problem is whith few baselayers, the function doesn't work and firebug say :

enter image description here

What can I dos for resolve this problem ?

  • Its CORS-related (enable-cors.org). The Source is extern? Try to set crossOrigin: 'anonymous' on your layer source or you could use a local proxy if the extern server doesnt support this Header (if the layer will not show up, then you know). – MichaelJS Jul 7 '15 at 13:58
  • Where can I set crossOrigin: 'anonymous' ? If I set this on the declaration of my layer, it doesn't work. I'm on a local server and I call tiles from an extern source. – Geo-x Jul 8 '15 at 7:55
  • In the layer SOURCE - like openlayers.org/en/v3.6.0/apidoc/ol.source.TileWMS.html. Check Browser Console if you can find Access-Control-Allow-Origin: "*". Network Analysis->Click a File received ->Header – MichaelJS Jul 8 '15 at 8:38
  • addition: If you cant set the "overall server configuration" just add in the .htaccess Header set Access-Control-Allow-Origin "*" – MichaelJS Jul 8 '15 at 10:34
  • If I add crossOrigin: 'anonymous' to my layer, tiles don't load in my map, all is white ... – Geo-x Jul 21 '15 at 9:59

Your Answer

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

Browse other questions tagged or ask your own question.