How to add WMS Layer from Mapserver( localhost) on Cesium Globe?

I am trying to add WMS layer from mapserver i.e. from localhost on Cesium Globe with the following HTML code. But I am not able to load or connect Cesium with the Mapserver and nothing is displayed on the browser. Mapserver is running successfully, there is no issue with Mapserver, I am not able to locate the error in the following code. Please tell me where I went wrong in the code.

The script, I used is -

<script id=“cesium_sandcastle_script”>
function startup(Cesium) {
“use strict”;
var viewer = new Cesium.Viewer(‘cesiumContainer’);
// Add a WMS imagery layer
var imageryLayers = viewer.imageryLayers;
imageryLayers.addImageryProvider(new Cesium.WebMapServiceImageryProvider({
url : ‘’,
layers : ‘bluemarble’,
parameters : {
transparent : true,
format : ‘image/png’

// Start off looking at Australia., -45.837, 148.970, -5.730));//Sandcastle_End
if (typeof Cesium !== "undefined") {
} else if (typeof require === "function") {
require(["Cesium"], startup);


Is there anything in the browser’s console? Any exceptions? The most likely problem is that your server does not support CORS, so browser security prevents Cesium (or any other WebGL-based library) from accessing it.


  I checked there is no problem with the browser's console. Actually it runs fine for WMS servers which are online, but I am having problem regarding WMS service through localhost. I am having Mapserver, it is running fine without any problem; but I am not getting the correct URL for calling WMS service from localhost Mapserver. Infact with this demo also its not working. Please indicate where I went worng with this code.
Thanks for the reply !


I think you need to provide more context/details for your problem. There are a number of things that could go wrong.

- CORS: as Kevin indicated your server may not support CORS:
- WMS URL: in your example: This is not a localhost and I think the URL should be the base URL like: or the localhost-equivalent.
- projection issues

Apart from the Console observe also the network traffic in the browser debugger: outgoing requests and their responses+HTTP codes.


Just van den Broecke

PS Please reply to the last answer given, so the mail thread gets preserved.