5

I downloaded Cesium Java Script library for creating 3D Globes from "http://cesium.agi.com/". Also I found that, they are using Bing satellite map as default. But I need to display layer from My Geoserver. I am very new to this Java Script library.

Can you please tell me , How to add a WMS Layer from Geoserver on the Cesium globe? Is it possible?

Thanks

1
  • Is it not throwing proxy error? If so, how did you overcome it? Please provide some hint to overcome the proxy issue. Commented Nov 6, 2013 at 6:36

1 Answer 1

6

Ya I got It... Here is the solution

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Hello World!</title>
  <script src="Cesium/Cesium.js"></script>
  <style>
  @import url(Cesium/Widgets/CesiumWidget/CesiumWidget.css);

  #cesiumContainer {
      position: absolute;
      top: 0;
      left: 0;
      height: 100%;
      width: 100%;
      margin: 0;
      overflow: hidden;
      padding: 0;
      font-family: sans-serif;
  }

  body {
      padding: 0;
      margin: 0;
      overflow: hidden;
  }


</style>
</head>
<body>
  <div id="cesiumContainer"></div>
  <script>

var widget = new Cesium.CesiumWidget('cesiumContainer');
var url='http://localhost:8080/geoserver/wms'; //Geoserver URL
var layers = widget.scene.globe.imageryLayers;
    layers.removeAll();
    layers.addImageryProvider(new Cesium.WebMapServiceImageryProvider({
        url : url,        
        layers: 'GIS_Demo'// Here just give layer name
    }));

Sandcastle.finishedLoading();

  </script>
</body>
</html>
2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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