Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crossOrigin setting not passed to images requested by ol-cesium #588

Open
icemagno opened this issue May 9, 2018 · 3 comments
Open

crossOrigin setting not passed to images requested by ol-cesium #588

icemagno opened this issue May 9, 2018 · 3 comments

Comments

@icemagno
Copy link

icemagno commented May 9, 2018

I'm receiving an obscure message from browser comming from Cesium packed with https://github.com/openlayers/ol-cesium/releases/tag/v1.37

An error occurred in "mf": Failed to obtain image tile X: 4 Y: 2 Level: 3. Cesium.js:459:3692

Was hard to discover its a CORS problem and actually I'm not very happy with this huge limitation because I'm trying to put my 2D map aside and I can't show most of my layers because they come from external Geoservers in WMS format.

Thinking better... The Cesium folder inside OL-Cesium is not yours is it ?

Any way ... Will be nice if you can say something about this:

https://gis.stackexchange.com/questions/282329/ol-cesium-error/282347

Thanks and you can close as soon you read.

@ahocevar
Copy link
Member

ahocevar commented May 9, 2018

Sorry @icemagno, I haven't been involved in ol-cesium development in a long time.

The problem here is very likely that Cesium does not request images with img.crossOrigin set to 'anonymous'.

@ahocevar ahocevar changed the title Please ahocevar can you give a look here? crossOrigin setting not passed to images requested by ol-cesium May 9, 2018
@wallw-teal
Copy link

wallw-teal commented Jun 15, 2018

#581 would fix this, assuming the layer works on the OpenLayers side with the crossOrigin value set. We've opted to extend that class and implement it ourselves, which you can see here (note that it does rely on our custom TilingScheme, so you might need a mix of what is in #581 and the requestImage function from our ImageryProvider).

Even if you do all that, Cesium must have CORS enabled on remote imagery for it to work. Note the crossOrigin value added to the source options from your snippet below.

var layer2 = new ol.layer.Tile({
      source: new ol.source.TileWMS({
        crossOrigin: "anonymous", // or "use-credentials", but not "none"
        url: 'https://demo.boundlessgeo.com/geoserver/wms',
        params: {
          'LAYERS': 'opengeo:countries'
        }
      })
});

@tlepkowski
Copy link

Also getting cross-origin error on KML example (for the KML file).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants