1

I have saved a html file from Cesium SandCastle live editor, but I am not able to run that file on a web browser afterwards, even after loading all the JavaScript files correctly. How to make it run on the web browser ? I am using google chrome and webGL is already being installed in Google Chrome.

HTML code-

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">  <!-- Use Chrome Frame in IE -->
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
    <meta name="description" content="Add imagery from a Web Map Service (WMS) server.">
    <meta name="cesium-sandcastle-labels" content="Beginner">
    <title>Cesium Demo</title>
    <script type="text/javascript" src="../Sandcastle-header.js"></script>
    <script type="text/javascript" src="../../../ThirdParty/requirejs-2.1.9/require.js"></script>
    <script type="text/javascript">
    require.config({
        baseUrl : '../../../Source',
        waitSeconds : 60
    });
    </script>
</head>
<body class="sandcastle-loading" data-sandcastle-bucket="bucket-requirejs.html">
<style>
    @import url(../templates/bucket.css);
</style>
<div id="cesiumContainer" class="fullSize"></div>
<div id="loadingOverlay"><h1>Loading...</h1></div>
<div id="toolbar"></div>
<script id="cesium_sandcastle_script">
function startup(Cesium) {
    "use strict";
//Sandcastle_Begin
var viewer = new Cesium.Viewer('cesiumContainer');

// Add a WMS imagery layer
var imageryLayers = viewer.imageryLayers;
imageryLayers.addImageryProvider(new Cesium.WebMapServiceImageryProvider({
    url : 'http://nationalmap.nicta.com.au/proxy/http://geoserver-nm.nicta.com.au/geotopo_250k/ows',
    layers : 'Hydrography:bores',
    parameters : {
        transparent : true,
        format : 'image/png'
    }
}));

// Start off looking at Australia.
viewer.camera.viewRectangle(Cesium.Rectangle.fromDegrees(114.591, -45.837, 148.970, -5.730));//Sandcastle_End
    Sandcastle.finishedLoading();
}
if (typeof Cesium !== "undefined") {
    startup(Cesium);
} else if (typeof require === "function") {
    require(["Cesium"], startup);
}
</script>
</body>
</html>
  • please post your html here or somewhere – Below the Radar Jan 16 '15 at 20:03
2

Just downloading the HTML and a handful of the javascript is not the best way to get started with Cesium Sandcastle.

Sandcastle uses Cesium in asynchronous mode, so all the underlying javascript is loaded as it is needed, and not combined into one file and accessible under a global Cesium object. You'd have to go through and manually download all the source files to get it to work just from downloading everything, and that could be a pain.

Instead of trying to copy the website manually, you can just download Cesium from the github repo and work on it from there. There are some pre-built example pages you can work on that come with the repo in the /Apps folder.

If you build the repo using Ant (which also comes with the repo download) as per the instructions here, it will also make a local copy of all the latest documentation, and a local copy of sandcastle for you.

Your Answer

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

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