Problem with WMS as basemap

Hello,

I need to add WMS (served by geoserver) as basemap in my Cesium project. According to instruction, which i found in the Internet, i’m using Cesium.WebMapServiceImageryProvider function.

I received the following error in the web browser console:

An error occurred in “WebMapServiceImageryProvider”: Failed to obtain image tile X: 2305 Y: 430 Level: 11.

I attach link to the sandcastle.cesium.com code : project

Can you help me?

Best regards,
Adam

Welcome back to the Cesium forum Adam!

There’s two issues going on here - first, you’re loading WMS over http, while your project (Sandcastle) is hosted over https, so the browser will reject these requests as insecure.

Second, it looks like this WMS server is not configured to allow requests made from other domains. If you try to run your project locally over http you’ll see this error:

Access to XMLHttpRequest at ‘http://mapy.fotoraporty.pl:8080/geoserver/GeoZet/wms?transparent=true&format=image%2Fpng&service=WMS&version=1.1.1&request=GetMap&styles=&layers=Mordy_Ortofotomapa&bbox=-135%2C0%2C-90%2C45&width=256&height=256&srs=EPSG%3A4326’ from origin ‘http://localhost:8080’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.

Omar, thanks for response.

Ok, unfortunately i can’t loading WMS from this geoserver over HTTPS.

On the other hand, i use the same WMS in web-application such as openlayers and it works fine, so the geoserver allow requests made from other domains.

What do you suggest to do in my case?

How are you running your OpenLayers application? Is it on your own website or on a local server?

If OL can access it then CesiumJS should be able to as well if you run it from the same web server.

Link to OL map: [map ](http://mapy.fotoraporty.pl/Mordy

OL application is on the web hosting. Can you try to add above WMS to any sample project?

Yes this works because the requests for the WMS are coming from the same domain. Your map is hosted on http://mapy.fotoraporty.pl/Mordy/ and the GeoServer is on http://mapy.fotoraporty.pl.

If you put your CesiumJS map on your website it will work.